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


Your Email:

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



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

 

HTML Tip:
Problems With Nested HTML Tags

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

  
November 2000
(Part 2)
Vol. 3, No. 16
 • Design Tip
 • HTML Tip
 • Promotion Tip
  

Have you ever had a Web page display perfectly in Explorer, but look awful in Netscape even though you avoided browser-specific techniques? The solution may be simpler than you think: check your HTML code for improperly nested tags.

Netscape versions 4.x and below enforce HTML coding standards more strictly than Explorer and Netscape 6.0. Their different interpretations can make problems hard to find.

Problems With Nested Tags

Nesting describes the structural relationship between tags in HTML code. When Tag A is nested inside Tag B, then Tag A should be opened and closed before Tag B is closed. Mixing up the tags can cause unpredictable results.

Let's look at a simple example first:

<b>This text is in bold for emphasis
<u>and this is underlined.</b>
This should be underlined, but not bold</u>.

Note that we closed the bold tag inside the underline tag. The designer may expect the browser to stop rendering the text in bold, but keep underlining. That doesn't always happen.

Netscape 4.x renders the text like this:

This text is in bold for emphasis and this is underlined. This should be underlined, but not bold.

While Explorer 5.0 and Netscape 6.0 interpret it this way:

This text is in bold for emphasis and this is underlined. This should be underlined, but not bold.

Netscape 4.x swaps the closing bold and underline tags. This closes the tags in the proper order according to HTML standards - but may cause unanticipated results.

Careful With Multiple Tags

This problem can get really confusing if you're dealing with several different tags and get them nested out of order. At that point, it's almost impossible to predict how browsers might render the page.

This code mixes two BOLD tags with two FONT tags:

<b>
<font face="arial">
<font color="red">
This text is in red for emphasis!
</font>
This text is still in bold type.
</b>
Now, this is supposed to be regular type, not
<b>bold</b>.
</font>

The main problem here is a simple error: the opening bold tag is misplaced in relation to the FONT tags.

Netscape 4.x gets completely confused and uses the first closing bold tag as a closing font tag - causing the font to abruptly change from Arial to Times Roman (or whatever font is the browser's default) and leaves the rest of the text still in bold type.

This text is in red for emphasis! This text is still in bold type. Now, this is supposed to be in regular type, not bold.

Again, Netscape 4.x is enforcing the HTML rule that nested tags must be closed before their parent tags.

Explorer 5.0 and Netscape 6.0 display it like the designer probably intended and display all the text in Arial:

This text is in red for emphasis! This text is still in bold type. Now, this is supposed to be in regular type, not bold.

While it may seem that Netscape 6.0 will solve your cross-browser problems, don't count on it anytime soon. Netscape just released 6.0 in November 2000 and most Internet users are notoriously slow to upgrade. Improperly nested tags will cause you and your visitors problems for a long time.

Use HTML Toolbox To Find Errors

These types of errors can drive even experienced Web developers crazy because they're not immediately obvious - especially if the code is dense or poorly organized. Save yourself time, effort, and frustration by checking your Web pages with NetMechanic's HTML Toolbox.

Toolbox will scan your pages and alert you to nesting errors and other coding problems and techniques that can affect your page display across browsers.



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.