Improve Site Performance Increase Site Traffic Monitor Site Uptime Webmaster Resources NetMechanic Home Looking For Help? Partner Programs Privacy Policy Contact Us Press Room
NetMechanic Home LOGIN | HELP | ABOUT US | PRODUCTS | SITE MAP
NetMechanic Menu
Over 52 Million Web Pages Tested!     
 
search engine submission service.
Search for:


Your Email:

I would like to receive my newsletter in:
HTML format
Text format


search engine listing.
Volume 8 (2005)
   September
   June
   April
   March
   January

Volume 7 (2004)
   November
   September
   July
   June
   May
   April
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 6 (2003)
   December
   November (Part 2)
   November
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 5 (2002)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 4 (2001)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 3 (2000)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June
   May
   April
   March
   February
   January

Volume 2 (1999)
   December
   November
   October
   September
   July
   June
   May
   April
   March
   February
   January

Volume 1 (1998)
   December
   November
   October
   September

 

CSS Tip:
Cover Your Tables With Style Sheets

by Larisa Thomason,
Senior Web Analyst,
NetMechanic, Inc.

  
August 2001
Vol. 4, No. 15
 • Promotion Tip
 • CSS Tip
 • Beginner Tip
  

Cascading Style Sheets (CSS) were supposed to make layout with tables obsolete. But because of browser incompatibility problems, most Web designers still use tables instead of style sheets to control layout. This means that style sheets and tables coexist on the same Web sites. That mixture leads to unexpected problems in some browsers.

CSS And Inheritance

Mention inheritance to the average person and they're likely to think of a rich uncle who might just leave them his fortune. With style sheets though, inheritance is something completely different. It refers to the ability of one property to inherit the properties of an enclosing tag.

For example, suppose you have the following style sheet declaration on your Web page:

<STYLE>
BODY {font-family:verdana; color:blue}
</STYLE>

In this declaration, you're setting all the text on the page to display in blue Verdana font. All the page elements inside the BODY tag should have those characteristics - paragraphs, lists, headers, etc.

Style sheets greatly simplify coding because you don't have to keep repeating the FONT tag for every page element: one declaration does it all.

Netscape And Tables

Doesn't that sound too good to be true? Well it is. Tables and CSS declarations don't play well together on the same page in some Netscape versions. Although TABLE tags are always inside the BODY tag, Netscape 4.x browser versions don't apply the BODY style declarations inside tables.

CSS authors who spend hours defining styles and applying them to their Web pages often find that little - if any - of their intended formatting displays in Netscape. That's because most Web designers still use tables to control page layout. On some Web pages, every bit of page content is inside a table.

Look at how Explorer 5.0 and Netscape 4.7 display the same page with the style attributes from the previous section. We noted the tags so you can see how each browser applies the styles:

Style sheets in Explorer compared to Netscape

The header and paragraph tags inherit the formatting from the BODY tag in both browsers. But look at the table content in Netscape: instead of green Verdana text, it's black Times Roman (Netscape's default text and color).

Be Specific For Netscape

This can seriously frustrate Web developers who are just beginning to use style sheets, but it's easy to fix. When you set your style properties for the BODY of the document, include TR and TD in that declaration like this:

<STYLE>
BODY, TR, TD {font-family:verdana; color:blue}
</STYLE>

Although technically you shouldn't have to specify style attributes for your tables, adding them solves the Netscape 4.x display problem.

For more discussion of style sheets in general, refer to our July 2000 newsletter article.

CSS were supposed to help solve display problems, but it doesn't always work that way. There are other browser display issues to consider too: sometimes certain HTML tags, tag placement, or simple coding errors can break your page in one browser but display perfectly in another.

Quickly find problems that affect your page display with NetMechanic's Browser Photo tool. Browser Photo will show you how your page displays in 14 different browser and operating system combinations. It gives you the resources of a complete testing lab without the expense.



Rate This Tip:
Not Useful Useful Very Useful   
 
NetMechanic Tools
HTML Toolbox
Browser Photo
Server Check
Search Engine Starter
Search Engine Tools
GIFBot
Newsletter
HTML Tutorial and Tips
Search Engine Tutorial
Accessibility Information
Browser Problem Tutorial

Company Info
Products
About Us
Contact
Advertise
Link To Us
Jobs
Privacy Policy
Partner Programs
Press Room
RSS Feed
Support
 



Powered by Overture!

 
     
 
   
 
     


Keynote Home
Copyright © 1996-2007,
Keynote NetMechanic
All rights reserved.