Jump to content

aligning text within a table


Hamish

Recommended Posts

Hi All,

 

I have a table presenting the returns from a MySQL query, the table is itself aligned "centre".

I would like to align the cell contents "left aligned".

 

echo("<center><table border = \"1\">");

echo("<tr><td><b>Col1</b></td><td><b>Col2</b></td><td><b>Col3</b></td><td><b>Col4</b></td>");

// loop round each record

while ($rec = mysql_fetch_array($result))

{

echo("<tr><td>" . $rec["Col1"] . "</td>");

echo("<td>" . $rec["Col2"] . "</td>");

echo("<td>" . $rec["Title"]. " " . $rec ["FirstName"] . " " .$rec["SName"]. " " ."</td>");

echo("<td>" . $rec["Col4"] . "</td>");

}

echo("</table></center>");

 

Any help would be much appreciated.

 

Regards

Hamish

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/47520-aligning-text-within-a-table/
Share on other sites

Hi All

The <td align=left> formats the data correctly,

However on Transitional validation W3C

gives the following error:

 

An attribute value specification must be an attribute value literal unless SHORTTAG YES is specified.

 

Could anyone enlighten me please?

 

Hammish

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.