ctcp Posted March 21, 2011 Share Posted March 21, 2011 .centered { top: 50%; left: 50%; width: 80px; height: 130px; background-image: url(images/stand.gif); background-repeat: no-repeat; } .cent { margin-left: auto; margin-right: auto; } <table align="center" > <tr> <?php $Recordset1_endRow = 0; $Recordset1_columns = 10; // number of columns $Recordset1_hloopRow1 = 0; // first row flag do { if($Recordset1_endRow == 0 && $Recordset1_hloopRow1++ != 0) echo "<tr>"; ?> <td align="center"><div class="centered"><div><img src="images/flag/<?php echo $row_Recordset1['country']; ?>.gif"></div><?php echo $row_Recordset1['username']; ?><div class="cent"><img src="images/floga.gif" /></div></div></td> <?php $Recordset1_endRow++; if($Recordset1_endRow >= $Recordset1_columns) { ?> </tr> <?php $Recordset1_endRow = 0; } } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); if($Recordset1_endRow != 0) { while ($Recordset1_endRow < $Recordset1_columns) { echo("<td> </td>"); $Recordset1_endRow++; } echo("</tr>"); }?> </table> how to .cent align to center? Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/ Share on other sites More sharing options...
cssfreakie Posted March 21, 2011 Share Posted March 21, 2011 could you instead of posting your php (which is a serverside script) post the outputed html. or maybe link to online content so we can inspect it. Btw, why on earth are you placing div's in a table. and why are you using tables for this? -edit: btw to center a div (or any block element, you first need to give it a width other than 100% (which is the default value) Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/#findComment-1190375 Share on other sites More sharing options...
ctcp Posted March 21, 2011 Author Share Posted March 21, 2011 <style> .centered { top: 50%; left: 50%; width: 80px; height: 130px; background-image: url(images/stand.gif); background-repeat: no-repeat; } .cent { margin-left: auto; margin-right: auto; } </style> <table align="center" > <tr> <td align="center"><div class="centered"><div></div><div class="cent"></div></div></td> </tr> </table> how to the second div aligh center? i whant add one image in div center Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/#findComment-1190395 Share on other sites More sharing options...
Maq Posted March 21, 2011 Share Posted March 21, 2011 Please use tags when posting code on the forum. Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/#findComment-1190398 Share on other sites More sharing options...
cssfreakie Posted March 21, 2011 Share Posted March 21, 2011 did you read the link it added? anyway i gave the things some color and indentation: easier to see what you do: not sure if this is what you want, but the cryptic: how to div in div... doesn't make it any clearer <style type="text/css"> .centered { top: 50%; left: 50%; width: 80px; height: 130px; background-image: url(images/stand.gif); background-repeat: no-repeat; border:1px solid red; } .cent{ margin-left: auto; margin-right: auto; min-height: 10px; width:20px; background:#000; } </style> <table align="center" > <tr> <td align="center"> <div class="centered"> <div></div> <div class="cent"></div> </div> </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/#findComment-1190402 Share on other sites More sharing options...
ctcp Posted March 21, 2011 Author Share Posted March 21, 2011 cssfreakie thank you mate thank you very much Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/#findComment-1190456 Share on other sites More sharing options...
cssfreakie Posted March 21, 2011 Share Posted March 21, 2011 cssfreakie thank you mate thank you very much lol i assume it's fixed? Quote Link to comment https://forums.phpfreaks.com/topic/231281-how-to-div-in-div-centerent/#findComment-1190467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.