Beruflich Dokumente
Kultur Dokumente
?Why XHTML
Many pages contain BAD HTML
<html>
<head> <title>This is bad HTML</title>
<body>
<h1>Bad HTML
</body>
HTML XHTML
<ul> <ul>
<li>Coffee</li> <li>Coffee</li>
<li>Tea <li>Tea
<ul> <ul>
<li>Black tea</li> <li>Black tea</li>
<li>Green tea</li> <li>Green tea</li>
</ul> </ul>
<li>Milk</li> </li>
</ul> <li>Milk</li>
</ul>
XHTML vs. HTML
XHTML Elements Must
Always Be Closed
XHTML
HTML
<p>This is a paragraph</p>
<p>This is a paragraph
<p>This is another
<p>This is another paragraph paragraph</p>
XHTML
HTML
<body>
<BODY>
<p>This is a paragraph</p>
<P>This is a paragraph</P>
</body>
</BODY>
XHTML vs. HTML
XHTML Documents Must Have One Root Element
<html>
<head> ... </head>
<body> ... </body>
</html>
XHTML more syntax rules
Attribute names must be in lower case
HTML: <table WIDTH="100%">
XHTML: <table width="100%">
Attribute values must be quoted
HTML: <table width=100%>
XHTML: <table width="100%">
Attribute minimization is forbidden
HTML: <input readonly>
XHTML: <input readonly=“readonly” />
XHTML more syntax rules
The id attribute replaces the name attribute
HTML: <img src="picture.gif" name="picture1" />
XHTML: <img src="picture.gif" id="picture1" />
The XHTML DTD defines mandatory elements
All XHTML documents must have a DOCTYPE
declaration. The html, head and body elements must be
present, and the title must be present inside the head
element
<!DOCTYPE Doctype goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>Title goes here</title> </head>
<body> </body>
</html>