Set Font Size in Tables Using DHTML

Set Font Size in Tables Using DHTML


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 = "10pt"

and add the CLASS=listTable to each?


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.

See also  How College Students Can Shape the Future of Tech Responsibility

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist