Your math is not entirely correct.
Let them start with the eyeball ....
Boxes Simple Messagehave a width:
2% + 46% + 2% + (1 px BORDER on each side) + (10px PADDING on each side)
This is more than 50%!
CSS box model , , CSS (, IE , ).
, border padding .message Simple Message.
Simple Message 41%, .
, , ....
, :
class box
500px wide with a 1px border all around
Pixels left to play with ==> 500
class content
15px padding on the OUTSIDE of .content on all side.
content is INSIDE .box, the maximum width of .content is 500px
but the padding is taking up some of this space (15*2 = 30px)
Pixels left to play with ==> 470
class message info
The maximum width of anything inside .content is 470px
There are two _50% boxes, so each can have a max total width
(including all the padding, border, margin) of 470/2 = 235px
Width of
+ 46% of 470px = 216.2 = 216px
+ 2*10px padding = 20px
+ 2*1px border = 2px
+ 2*(2% of 470px) = 2*9.4 = 2*9 = 18px
256px! ==> 2*256 > 470
, 41%?
class box
Pixels left to play with ==> 500
class content
Pixels left to play with ==> 470
class message info
Width of
+ 41% of 470px = 192.7 = 193px
+ 2*10px padding = 20px
+ 2*1px border = 2px
+ 2*(2% of 470px) = 2*9.4 = 2*9 = 18px
---------------------------------------
233px ==> 2*233 < 470
, 42% ,
42% of 470 = 197.4 = 197.
197 + 20 + 2 + 18 = 237
237 * 2 = 474........ and 474 > 470
, Firebug. , Layout, , Style, CSS!
:
.box .content {
overflow: auto;
}