Subject: [css-d] 2 columns centered but unkown width?

From: Andreas.Reuterberg at staff.spray.se (Andreas Reuterberg)
Date: Tue, 29 Apr 2003 10:55:40 +0200

I have a slight problem. I know how to solve it but I would like an easier alternative. I have two columns, one of them is 200px wide (for example) and the other one is sometimes 200px and sometimes 0px (shouldn't be shown). The problem is that these two columns need to be centered on the page and to do that I need to put them in a <div> and set that width to the width of them both together. But I need to get rid of that set width (300px) because the content in the right column is there sometimes and sometimes it's not (it contains a banner). I know how to do this with tables but.. Well, tables suck :)

Can anyone help me? This is a short example of the code:

<body style="text-align:center;">
	<div style="width:300px; border:1px solid;">
		<div style="float:left; width:200px; border:1px solid;">200px</div>
		<div style="float:left; border:1px solid;">100px</div>
	</div>
</body>

Andreas