(page requirements)

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

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>

  <font face="Arial">test 1</font>

  <font face="Arial">test 2</font>

  <font face="Arial">test 3</font>

  <font face="Arial">test 4</font>

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.

<STYLE TYPE="text/css">
TD{font-family: Arial; font-size: 10pt;}


<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>

Listing #2 : HTML code. Download tblcss2.html (0.29 KB).
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
Copyright © 2009 Chami.com. All Rights Reserved. | Advertise | Created in HTML Kit editor