Group 6 How To


Rules that change:



XHTML and HTML are still basically the same, XHTML requires that some rules have more strict elements in order for it to be validated. Some elements include all elements and attribute names must appear in lowercase, all attributes must be quoted, non empty elements require a closing tag, empty elements are terminated using a space and a trailing slash, no attribute minimization is allowed in XHTML, documents in XHTML must have one root element.



Examples of tags that change



1. Write tags in lowercase
<Ol> written like <ol>
2. End Tags are required
<p> must be written like <p> and then </p> or
<br> written like <br/>
3. Attributes must be quoted and include attributes
<table border=3> written like <table border=”3”>
4. Overlapping elements is wrong
<p>here is an emphasized<em>paragraph.</p></em>written like <p>here is an emphasized <em>paragraph</em>.</p>
5. Attribute Minimization
<dl compact> written like <dl compact=”compact”>
6. No empty elements
<br> written like <br/>
<hr> written like <hr/>
7. Using the ampersand outside of entities in URLs (use &amp; instead of & in links also)
Incorrect: <a href="index.php?page=news&style=5">News</a>
Correct: <a href="index.php?page=news&amp;style=5">News</a>
8. Using the ampersand outside of entities (use &amp; to display the ampersand character)
Incorrect: <title>Cars & Trucks</title>
Correct: <title>Cars &amp; Trucks</title>
9. The attribute “name” is to be refered to as “id”

10. <font face=”Arial” written like <font-family=”arial”>

Differences in code snippets


1. The attribute “name” is to be refered to as “id”
2. The “lang” attribute must be “xml:lang”
3. Must have a doctype
<!DOCTYPE html
PUBLIC "-W3CDTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3. Formatting within the document must be moved to a CSS file in XHTML.
5. . Overlapping elements
<p>here is an emphasized<em>paragraph.</p></em>written like <p>here is an emphasized <em>paragraph</em>.</p>



Web Resources


1. www.w3.org
2. www.webstandards.org
3. www.webdesign.about.com