Better explained with a markup:
HTML:
<div><!--both sidebar and content share width-->
<div id="content"><!--maybe at 30%-->
</div>
<div id="sidebar"><!--may be at 70%-->
</div>
</div>
CSS:
#sidebar{float:left;} /* no idea what width*/
#content{float:right;} /* no idea what width*/
What I want to do is that if the sidebar is not present in the markup, the content div expands to take the place of the sidebar:
<div>
<div id="content"><!--width now at 100%-->
</div>
</div>
You can acheive this if you flip your divs around like so:
The only drawback with this approach is that you will need to know how wide your sidebar is if you want to add any padding to your content div. That’s fixable, but as that wasn’t really your question, I won’t tell you how to suck eggs, I’m sure you can work it out 😉