Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS box model issue: box-sizing + 100% height + border + inline-block

Take a look at this fiddle: http://jsfiddle.net/WTcgt/

Why is the BOX1 pushed down by the amount of border of BOX2? Is this a bug?

like image 411
Stefan Avatar asked May 04 '26 03:05

Stefan


1 Answers

The box-sizing property is supported in Internet Explorer, Opera, and Chrome.

Firefox supports an alternative, the -moz-box-sizing property.

Safari supports an alternative, the -webkit-box-sizing property.

here is working example http://jsfiddle.net/WTcgt/2/

This is the behavior of inline-block:

An inline block is placed inline (ie. on the same line as adjacent content), but it behaves as a block.

use vertical-align:top to avoid this problem. If we doesn't use vertical-align property then elements align in same line based on adjacent element. For more information read http://www.impressivewebs.com/inline-block/ and http://www.brunildo.org/test/inline-block.html

like image 107
Valli69 Avatar answered May 05 '26 19:05

Valli69



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!