Search code examples
cssxhtmlxhtml-1.0-strict

Is it possible to render empty <div style="width:50%"> </div> with CSS in xHTML strict 1.0 without setting width and height in pixels?


Is it possible to render empty <div style="width:50%"> </div> with CSS in xHTML strict 1.0 without setting width and height in absolute values and not adding &nbsp; inside? Targets are IE7-8, FF 3.x

Can I somehow render empty div if I want it to get 50% width and variable height?


Solution

  • Add some padding to the DIV so that even if there is absolutely nothing between the opening and the closing tags, you still see something.

    <div style="width:50%; padding:10px;"></div>