How To Specify Font Styles For Text Inside Tables, The Easy Way

(page requirements) Chami.com Tips Chami.com HomepageFree online tools and servicesFree web design toolsTips indexHTML and JavaScript tipsInternet tipsWindows tipsProgramming tips Have Web Authoring Questions? | < Previous | Random | Next > Fast SSD virtual servers for $5! Chami.com TipsHome > Tips > Internet > How to specify font styles for text inside tables... Modern HTML editor 300+ book mentions, 95% thumbs up, millions of downloads. Get HTML-Kit Tools for $39 (limited time offer)  Web Hosting Web Hosting UK Dedicated Servers Domain Names Categories» InternetHTMLJavaScriptProgrammingWindows KeywordsCascading Style Sheets HTML Internet Explorer Internet Netscape / Mozilla World Wide Web Downloadstblcss1.html tblcss2.html

How to specify font styles for text inside tables, the easy way

See Also
  • Why shouldn't you wrap your pages with tables?
  • Tables can have background images too
  • Make it easier to identify cells using titles in your tables
  • How to create a blank cell with borders in a HTML table
If you're using font tags inside large tables to change the style of the text inside cells, you maybe making your pages larger than necessary. Let's look at the following sample table. Note how the FONT tags are being used to set the font style of text inside each cell. If you have a large table, these font style tags could multiply the size of your page, specially if the text inside the cells are smaller than the font tags. <table border=1> <tr><td> <font face="Arial">test 1</font> </td></tr> <tr><td> <font face="Arial">test 2</font> </td></tr> <tr><td> <font face="Arial">test 3</font> </td></tr> <tr><td> <font face="Arial">test 4</font> </td></tr> </table>Listing #1 : HTML code. Download tblcss1.html (0.22 KB). If your visitors are using Cascading Style Sheets enabled browsers such as {X_CSSBROWSERS} or compatible, you could use the TD{font-family: Arial; font-size: 10pt;} style sheet tag as follows. Doing so will make text inside all TD tags use the specified font face and other specified attributes such as the font size. <html> <head> <STYLE TYPE="text/css"> <!-- TD{font-family: Arial; font-size: 10pt;} ---> </STYLE> </head> <body> <table border=1> <tr><td> test 1 </td></tr> <tr><td> test 2 </td></tr> <tr><td> test 3 </td></tr> <tr><td> test 4 </td></tr> </table> </body> </html>Listing #2 : HTML code. Download tblcss2.html (0.29 KB). To share this: BlinkBits | BlinkList | Blogmarks | Co.mments | Connotea | Del.icio.us | Digg | Facebook | FrankIt | Furl | Ma.gnolia | Newsvine | Reddit | Yahoo Applicable Keywords : Cascading Style Sheets, Cascading Style Sheets 1, HTML, Internet Explorer, Explorer 3.x, Explorer 4.x, Explorer 5.x, Internet, Netscape Navigator, Communicator 4.x, Netscape 6.x, World Wide Web Previous Tip : Reading web server responseRandom Tip : Say no to program closings!Next Tip : Font embedding for web pages Copyright © 2009 Chami.com. All Rights Reserved. | Advertise | Created in HTML Kit editor

Từ khóa » Html Table Td Text Size