shadowline
What about HTML 5? << Conversion from HTML to XHTML >> XHTML Doctypes
This is probably going to be the most viewed page of my XHTML section. It shows how to convert your current pages from HTML into XHTML. A lot of the information is the same between the two types of coding and many of the differences you may have already started doing.



In HTML, there are many tags that may be omitted and still be considered as good coding. These include some ending tags of a set (such as the td tag) or foundation ones (such as the head and body tags). XHTML will not allow this. All main foundation tags and all closing tags must be included.



Tag and property names must be written in lowercase letters. Since XML is case-sensitive, XHTML tag and property names must be written in lowercase. Property values may still be any case you want.

wrong :
<TD BGCOLOR="#FF0000">

correct :
<td bgcolor="#FF0000">



All tags must nest properly, no overlapping. Some browsers don't care if you overlap elements even though it is considered bad HTML coding. With XML and XHTML, you need to close the tags in reverse order. (last opened = first closed)

wrong :
<b> Bold text <i> and italics too </b> </i>

correct :
<b> Bold text <i> and italics too </i> </b>



All tags, including empty tags) must have a termination or ending tag. Regular tags such as the P or LI tag are commonly used on their own without an ending tag. XML and XHTML must include the ending tags for all of the tag sets. Empty elements (those without a closing tag) have no content.

Empty tags are the special single tags such as br, hr, img, link and meta. Since these do not come as a set, a termination must be specified within the tag itself. This is done by entering a space and forward slash into the tag. Examples :

<br />
<hr />
<img src="somepic.gif" />

Technically, there isn't supposed to be a space before the forward slash, but it is needed for todays browsers to recognize it. The space is supported by the W3C standards for conformance.

Other tags affected by this are : area, base, frame, input, and option.



Property values must be quoted. If you follow good HTML coding practice, then you are probably already doing this. Every value must be quoted, even if it's numeric.

wrong :
<img src="somepic.gif" border=0>

correct :
<img src="somepic.gif" border="0" />

(Notice the use of the termination in the correct example too)



Tag properties cannot be minimized. There are some tag properties that are stated as a single word without a value assigned to them. XHTML requires that each property must have a quoted value assigned to it. Examples :

wrong :
<option value="myvalue" selected>
<input type="radio" name="Myname" checked>

correct :
<option value="myvalue" selected="selected" />
<input type="radio" name="Myname" checked="checked" />



For any pages using a nested list area, the inside list must be contained within a LIne tag set.

<ol>
<li> some info </li>
<li> some info </li>
  <li>
    <ol>
    <li> other stuff </li>
    <li> other stuff </li>
    </ol>
  </li>
<li> some info </li>
</ol>

Notice the use of the ending LI tags as well.



For any style or script areas (that is CSS and JavaScript), take out the comment tags surrounding the scripts. These comment tags are usually entered before and after the script/styles to hide them from older browsers. Considering most people have a browser version 4 or higher these days, these aren't necessary anyways. The W3C acutally recommends using external styles/scripts if possible instead of having them embedded.
What about HTML 5? << Conversion from HTML to XHTML >> XHTML Doctypes
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow