How i can align float:right DIVs into the middle of the page? I can't put them into an 40% or 60% div because the number of DIVs will be generate by a dynamic PHP file. Until now i have the code: .infobox { width:250px; height:250px; background-image:url('images/infoboxbg.gif'); float:left; } .infospace { width:20px; height:250px; float:left; margin:0 auto; } .infotext { font-size:12px; font-family:Verdana; color:#333; text-align:left; width:230px; padding-left:10px; height:190px; padding-top:3px; } .infotitle { margin:0 auto; text-align:center; width:230px; padding-top:6px; padding-bottom:3px; font-size:15px; font-family:Verdana; border-bottom:2px #aaa dotted; } </style> Code (markup): .... and doing something like: <div class=infospace></div> <div class=infobox> <div class=infotitle><b><font color=red>Yahoo problem!</font></b></div> <div class=infotext>You are dropping in serps in Yahoo</div> <div class=infotype><img src="images/alert_warning.gif"></div> </div> <div class=infospace></div> <div class=infobox> <div class=infotitle><b><font color=red>Google problem!</font></b></div> <div class=infotext>You are dropping in serps in Google</div> <div class=infotype><img src="images/alert_warning.gif"></div> </div> <div class=infospace></div> <div class=infobox> <div class=infotitle><b><font color=red>MSN problem!</font></b></div> <div class=infotext>You are dropping in serps in MSN</div> <div class=infotype><img src="images/alert_warning.gif"></div> </div> Code (markup): will only float all divs to left...i don't want to put them all to left, i want to align them on the same line, and put them in the middle... without float they will be aligned on of the top of each other
No problem, just search for a dynamic centering tutorial, like this one: Horizontally centering content with dynamic width in CSS Wrap your content with an extra div that has these properties: .infowrap { display: table; margin: 0 auto; } Like the tutorial says, it works in all browsers that recognize display: table, which does not include IE6 or IE7 unfortunately.