View Full Version : add code for font size under php echo code

11-11-2010, 07:58 AM
Good day!

I have a pure php code, so my table was in echo and I want to change the font and font-size of text in table header but when I put thid code:

echo "<font size="18" face='Arial'>";
echo "<table>";

and at the lower part i close it
echo "</table>";
echo "</font>";

It only take effect in the text outside the table. and when I try to put it on the <table> It doesn't take effect.

Thank you in advance

11-11-2010, 08:20 AM
Try this

echo '<table style="font-size:18px; font-family:Arial; color:red;"><tr><td>This is a test</td></tr></table>';

so, as you can see I've added a css-styles for the table.
you can also assign a class for a table and define styles for this class in your css-file
or just put to your css-file for all tables something like:

table {

11-11-2010, 04:34 PM
Yah, the font tag is outdated. If you need to modify visual elements, you now use CSS. And you're more often better then not putting CSS in an external file rather then inline.

11-12-2010, 03:12 AM
If it wasn't out of date... you would have needed to escape the quotes (or used single quotes) for it to work in any sort of way. However, the <font> never penetrates a table anyway and CSS is the only way to go nowadays.

echo "<font size=\"18\" face='Arial'>";