spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / authoring / languages / html / optimize 123456789

Extreme HTML Optimization

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

XHTML

XHTML, the marriage of HTML with XML, requires a more strict approach than HTML does. In XHTML, documents must be "well-formed." This is a new concept introduced by XML. Essentially this means that all elements must either have closing tags, or be written in a special form. Also, all elements must nest properly.

Element Nesting

Do this:

<p>This is an emphasized <em>paragraph.</em></p>

Not this:

<p>This is an emphasized <em>paragraph.</p></em> 

Closing tags are not optional in XHTML and can quirk up CSS on some browsers.

Empty Elements

Empty elements like <br> and <hr> must either have an end tag or end with />. For example:

<br /> or <hr></hr>

Note the extra space after the br. This is not required, but allows older browsers to properly parse these new self-closing XHTML tags.

Attributes Must be Quoted and Complete

All attributes must be quoted and complete. XHTML does not support attribute minimization, so instead of "checked" XHTML requires "checked='checked'".

Lower Case

As XHTML is case-sensitive, all tags and attributes must be lower case.

Even with these restrictions most of these tips can be used with XHTML. It is up to you how far you go. Note also that newer browsers like Netscape 6 require clean, properly nested HTML to function properly with dynamically-written external JavaScripts. See JavaScripting Netscape 6: No More Sloppy Code for details. Now, with those caveats out of the way, let's do some EHO.

home / authoring / languages / html / optimize 123456789
http://www.internet.com
Comments are welcome

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Working with the DOM Stylesheets Collection · Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Combine BottomCount() with Other MDX Functions to Add Sophistication · Creating a Daemon with Python · The Coming Voice-over-WiMAX Revolution

Created: Mar. 19, 2000
Revised: Mar. 19, 2001
URL: http://webreference.com/authoring/languages/html/optimize/