I am trying to specify the Font Face and Size for text in a table. It seems to respect the FACE= but ignores the SIZE=. For example, I have the HTML shown below. It correctly displays the text in Courier New, but both tables display with the same font size. Any clue what I am doing wrong?
<font face="Courier New" size="12"><table width="100%"><tr><td><b>Client</b></td><td><b>InstanceName</b></td><td><b>dbname</b></td><td><b>Filename</b></td><td><b>KeyName</b></td><td><b>Rotation</b></td><td><b>Path</b></td></tr> <tr><td>NEWDEV6</td><td>EXPRESS2012</td><td>master</td><td>master.mdf</td><td>test_key_16</td><td>0</td><td>d:\Program Files\Microsoft SQL Server\MSSQL11.EXPRESS2012\MSSQL\DATA\master.mdf</td></tr> </table></font> <font face="Courier New" size="24"><table width="100%"><tr><td><b>Client</b></td><td><b>InstanceName</b></td><td><b>dbname</b></td><td><b>Filename</b></td><td><b>KeyName</b></td><td><b>Rotation</b></td><td><b>Path</b></td></tr> <tr><td>NEWDEV6</td><td>EXPRESS2012</td><td>master</td><td>master.mdf</td><td>test_key_16</td><td>0</td><td>d:\Program Files\Microsoft SQL Server\MSSQL11.EXPRESS2012\MSSQL\DATA\master.mdf</td></tr> </table></font>
To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.
To style the text within a table, you use the same CSS properties that you would use in styling any text. The thing to remember is that, you need to know which HTML element to apply the style against. For example, to change the text color across the whole table, use the color property against the <table> tag.
Better still, use an external style sheet or a style tag near the top of your HTML document. See also http://www.w3schools.com/css/css_howto.asp . FYI, quotes are mandatory. But you're right, CSS, inline or otherwise, is the way to go, as FONT tag is not longer supported.
First, try omitting the quotes from 12 and 24. Worth a shot.
Second, it's better to do this in CSS. See also http://www.w3schools.com/css/css_font.asp . Here is an inline style for a table tag:
<table style='font-family:"Courier New", Courier, monospace; font-size:80%' ...>...</table>
Better still, use an external style sheet or a style tag near the top of your HTML document. See also http://www.w3schools.com/css/css_howto.asp .
Enclose your code with the html and body tags. Size attribute does not correspond to font-size and it looks like its domain does not go beyond value 7. Furthermore font tag is not supported in HTML5. Consider this code for your case
<!DOCTYPE html> <html> <body> <font size="2" face="Courier New" > <table width="100%"> <tr> <td><b>Client</b></td> <td><b>InstanceName</b></td> <td><b>dbname</b></td> <td><b>Filename</b></td> <td><b>KeyName</b></td> <td><b>Rotation</b></td> <td><b>Path</b></td> </tr> <tr> <td>NEWDEV6</td> <td>EXPRESS2012</td> <td>master</td><td>master.mdf</td> <td>test_key_16</td><td>0</td> <td>d:\Program Files\Microsoft SQL Server\MSSQL11.EXPRESS2012\MSSQL\DATA\master.mdf</td> </tr> </table> </font> <font size="5" face="Courier New" > <table width="100%"> <tr> <td><b>Client</b></td> <td><b>InstanceName</b></td> <td><b>dbname</b></td> <td><b>Filename</b></td> <td><b>KeyName</b></td> <td><b>Rotation</b></td> <td><b>Path</b></td></tr> <tr> <td>NEWDEV6</td> <td>EXPRESS2012</td> <td>master</td> <td>master.mdf</td> <td>test_key_16</td> <td>0</td> <td>d:\Program Files\Microsoft SQL Server\MSSQL11.EXPRESS2012\MSSQL\DATA\master.mdf</td></tr> </table></font> </body> </html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With