1. Home
  2. Computing & Technology
  3. Personal Web Pages

Clean Up Your Web Site
Create Well Formed HTML Web Sites With XHTML

From , former About.com Guide

HTML has been the best way to create a Web site for many years. If you want to create well formed an HTML Web site you need to follow a few simple XHTML rules to move your Web site from HTML to XHTML. Don't worry, it's not as hard as it sounds.

  • Add missing end tags - Whenever you use an HTML tag you must use the corresponding end tag that goes with it.

    example: <p></p>; <b></b>; <li></li>

  • Make sure your HTML tags nest rather than overlap - Keep your HTML tags in order.

    example of bad order: <p><b>this is bold</p></b>

    example of good order: <p><b>this is bold</b></p>

  • Use double or single quotes around your attribute values.

    bad example: <font face=sans-serif color=white size=+1>

    good example: <font face="sans-serif" color="white" size="+1">

  • Add values to all minimized Boolean attributes, even if they are the same name.

    bad example: <input type="checkbox" checked>

    good example: <input type="checkbox" checked="checked">

  • Change &, < and > to &amp;, &lt; and &gt; -

    example: change "me & her" to "me &amp; her"

  • Fix empty HTML elements.

    example:<hr> should look like <hr/> or <hr></hr>

  • Use hyphens in comment tags

    bad comment tag: <! this is a comment>

    good comment tag:

  • Make all element and attribute names lowercase

  • Eliminate all non-standard HTML elements like marquee

  • Add requited attributes like the alt attribute of img

  • Move HTML elements out of out from inside elements where they don't belong like blockquote from p

Explore Personal Web Pages
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Personal Web Pages

©2009 About.com, a part of The New York Times Company.

All rights reserved.