Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: DHTML
Expertise: Beginner
Oct 20, 1999

Set Font Size in Tables Using DHTML

Question:

In Microsoft Internet Explorer, I can specify a style as

TABLE.listTable { font-size : "10pt"}

and all the cells of the table will have a 10pt font size.

In Netscape, this approach doesn't work because the font sizes have to be specified for each cell (

), and any font specification you do at the table level doesn't apply to each cell. Can you suggest a solution so I don't have to specify something like

classes.listTable.td.fontSize = "10pt"

and add the CLASS=listTable to each

?

Answer:

You can specify a setting for table cells (TD) elements using a style sheet:

  TD { color: red; font-size: larger }

However, you have to be careful of your use of other style and formatting with the table as this can override the TD setting. For instance, not closing a table element, or using nested elements can turn off the global style setting.

For example, define a global style setting using:


and then create a table like this:

Hello there

The table contents will show red, with a larger font size, for Netscape Navigator 4.x and up, and IE 4.x and up, in a Windows environment.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap