It is important to note that using percent width is almost impossible. Take this, for example, if you want your “content” div to accept full width but have 10px indents:
#content { width: 100%; padding: 0 10px; }
This works in the (reasonable, but incorrect) IE model, but in standard compliant browsers your div will occupy 100% + 20 pixels wide, which is not good. The solution is to use another “internal” container.
<div id="content"> <div class="inner"> content here. </div> </div> #content { width: 100%; } #content .inner { padding: 0 10px; }
This is a bit annoying for the extra markup, but in the end it will simplify a lot.
nickf source share