I have some divs all set to width:100% on my website:
<div id="participate" class="test">
participate
</div>
<div id="description" class="test">
<div id="brief" style="display:table-cell">
</div>
<div id="price" style="display:table-cell">
</div>
</div>
<div id="bottom" class="test">
<div id="partners" class="test">
</div>
<div id="content" class="test">
</div>
</div>
Only #bottom has set display:table. When I set border I see #border is smaller excatly 2px than others div.
When I set #border width:100.3% it is ok however this solution seems retarted to me. The problem is present in chromium and absent in firefox.
Why is that and how can I get rid of it?
Any hint’ll be appreciated.
https://developer.mozilla.org/en/CSS/box-sizing
divelements default tobox-sizing: content-box, in whichborders are not part of thewidth.In Chrome, setting
display: tableforcesbox-sizing: border-box, in which the borders are part of thewidth.This is shown here: http://jsfiddle.net/thirtydot/wsEkc/
The easiest way to make the two
divs consistent is to applybox-sizing: border-box(and its vendor prefixed variants).See: http://jsfiddle.net/wsEkc/3/