Re:CSS Techniques I Wish I Knew When I Started Designing Web...
by Vindexus on Tuesday December 22, 2009 @10:15PM
(#1011429)
One way I get around the box model problem is to add a .padding div to the inside of an object and apply any padding to that. It adds an extra div which some people don't like, but I don't mind and it beats dealing with box model weirdness.
html:
<div class="300pixelbox">
<div class="padding">
This is 300 pixels wide and has 10px padding.
</div>
</div>
html:
<div class="300pixelbox"> <div class="padding"> This is 300 pixels wide and has 10px padding. </div> </div>
style:
.300pixelbox { width: 300px; }
.300pixelbox .padding { padding: 10px; }