Link to home
Start Free TrialLog in
Avatar of Cybervanes
Cybervanes

asked on

Floating two side by side div boxes to the center of a containing div

How could i float two side by side div boxes to the center of a containing div.

I need the  div boxes to remain in the center of the page regardless of the size of the browser window. But if there is room for them both to be displayed side by side that is how they should be displayed. ( still remaining in the center )

Any ideas?
<div aling="center" id="visiableContentWraper" style="width:100%;">
	<div id="automotive" style="float:left; width:520px;">
		content for automotive		
	</div>
	<div id"realEstate" style="float:left; width:520px;">
		content for realEstate
	</div>
</div>

Open in new window

Avatar of David S.
David S.
Flag of United States of America image

I suggest you use display:inline-block (with browser workarounds) instead of float:left. This explains how:
http://www.search-this.com/2007/09/19/when-is-a-float-not-a-float/
Avatar of Cybervanes
Cybervanes

ASKER

Yeah I already tryed that and I cant get it to work. Divs overlapping and only the far left side of the first div is aligned on the center line.

Thanks tho!
Please show us your the code you used when you tried that technique.  It is tricky, but I've used it many times myself.
ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!