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!     
 
learn about pitfalls with using the save as html option.
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:
Sorting With The OPTGROUP Element

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

  
October 2001
(Part 2)
Vol. 4, No. 20
 • Promotion Tip
 • HTML Tip
 • JavaScript Tip
  

Until recently, the OPTGROUP element belonged to that lonely category of valid HTML tags that most major browsers didn't recognize. Fortunately, Netscape 6.x and Explorer 6.0 for Windows have joined Explorer 5.0/Mac in supporting this handy way to categorize SELECT lists. Use it to make your lists easier to read and understand.

Categorize Long SELECT Lists

The HTML 4.0 specification tried to increase the functionality of menus so that they could be separated into categories or displayed in a hierarchy. This is the purpose of the OPTGROUP element. It groups different OPTION tags under a common name or label.

Add it to a regular SELECT list like this:

Place the opening and closing OPTGROUP tags around the related options. In this list, we set up categories for beaches, Europe, and adventure destinations.

Browser Support

Explorer 5.x/Win, Netscape 4.x/Win, and WebTV ignore the OPTGROUP tags and labels, but still display all the options. Netscape 6.0 shows you both the options and categories.

Explorer 5.0 for Windows
Example of OPTGROUP tag in Explorer 5.0

Netscape 6.0 for Windows
Example of OPTGROUP tag in NS 6.0

Explorer 6.0 for Windows displays the OPTGROUP tag much like Netscape 6.0 example above. Still, that's not exactly what the HTML 4.x standard calls for.

Note that the whole list displays with its category titles in NS 6.0. The LABEL attribute is actually supposed to turn the SELECT list into a cascading list where you see just the category titles at first. Members of each category should display in a cascading menu when you move the mouse over the category name.

Explorer 5.0/Mac supports it fully. See the difference?

Explorer 5.0 for Mac
Example of OPTGROUP in Explorer/Mac

Depending on your perspective, "full support" may or may not be a good thing. Some Web designers have remarked that they prefer to see all the categories and options at once instead of having to navigate to the options using their mouse. Visitors who have problems using a mouse would probably agree.

Watch Your Syntax

Some things to remember about the OPTGROUP element:

  • It must be placed inside a SELECT tag.
  • A closing tag is required (</OPTGROUP>).
  • It can only contain OPTION statements.

But the most important point is that only the newest browsers support OPTGROUP. But use it anyway! Some HTML coding techniques or errors can break your page display, but OPTGROUP is low-impact. Older browsers just ignore the element and display a regular SELECT list.

Include OPTGROUP on your new pages and when you update your forms and menus. You can even combine OPTGROUP with our tip for creating colored SELECT lists to get some really impressive effects. It won't hurt you with non-compliant browsers and it's a neat effect to use with the new ones.



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.