How do I text-align center, when floating left?
Posted: Wed Aug 07, 2013 9:43 am
I am trying to line up DIVs, but to get them centered inside another DIV. So rather than lining up from the left, they are horizonally centered. I'm sure it's easy to do, but having trouble seeing how.....
Code: Select all
<style>
.subcat_topboxes
{ width: 250px;
float: left;
}
</style>
echo "<div style='text-align: center'>";
$result = mysql_query ("SELECT name, photo, information FROM subcategories WHERE catid = '$catid'");
while ($row = mysql_fetch_object($result))
{
echo "<div class='subcat_topboxes'><img src='/images/pages/$row->photo' /><br/>$row->name<br/>$row->information</div>";
}
mysql_free_result($result);
echo "<div style='clear: both' /></div></div>";