View Full Version : align..problem

12-12-2005, 09:07 PM
Hello again:)

im trying to align in center some rows of this table..

$result_array[] = "<a href='index.php?cid=$cid&pid=".$row[0]."'><img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' />
<td><a href='index.php?cid=$cid&pid=".$row[0]."'>".$row[1]."</td>
<td><a href='index.php?cid=$cid&pid=".$row[0]."'>".$year = substr($row[3],0,4)."/".$month = substr($row[3],4,2)."/".$day = substr($row[3],6,2)."</td>
<td><p><a href='index.php?cid=$cid&pid=".$row[0]."'>$day/$month/$year</a></p>
<p><a href='index.php?cid=$cid&pid=".$row[0]."'>$countdown</p></td>
<td><a href='index.php?cid=$cid&pid=".$row[0]."'>$countdown</td>

and i try this

<td><div align="center"><a href='index.php?cid=$cid&pid=".$row[0]."'>$countdown</a></div></td>

what im doing wrong?? i dont understand:confused:

12-12-2005, 09:52 PM
This really should be in the HTML & CSS forum, as the fact that your using PHP has nothing to do with the problem. However, all you need to do is give the td the align='center' attribute, and it will work fine.

Div's will always take up the maximum width of their container (in this case the td) unless given a width with CSS. Therefor the align on the div doesn't make sence, because it is taking up the entire width.

If you want to keep the div, use:

<div style='text-align:center;'></div>
and this should also do the trick.

12-12-2005, 10:03 PM
Thnx friend..is working...
and now a dump question:)

where can i find infos about the use of (div,td,tr..etc)???

Velox Letum
12-13-2005, 12:29 AM

12-13-2005, 06:42 PM