XHTML
Printer Friendly Page
- XHTML starts with standard HTML 4.01.
- XML standards are applied to the HTML code.
- All elements must be properly nested. (Well-formed).
- All elements need end tags like </p>.
- Tag names must be lower-case.
Basic
XHTML Structure:
<html>
<head> . . . </head>
<body> . . . </body>
</html>
Empty elements end with "/>:
Line breaks <br />
Rulers <hr />
<img src . . . />
Non-empty elements have a closing tag:
<p>This paragraph has a closing tag.</p>
Attribute values must be in quotes:
<table width = "100" >
XHTML documents require a
DOCTYPE and a
NAMESPACE:
<!DOCTYPE doctype goes here >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> . . .</title>
</head>
<body>
</body>
</html>
- The DOCTYPE declaration [DTD] is not part of the XHTML dcocument
and does not have a closing tag.
- The DOCTYPE is required and must be the first line in the document.
- Three DOCTYPES:
- STRICT
- TRANSITIONAL
- FRAMESET
- The DTD defines the syntax allowed in the XHTML markup
STRICT DTD:
Used with
CSS, since it avoids HTML formatting tags.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3/org/TR/xhtml1/DTD/xhtml1-strict.dtd">
TRANSITIONAL DTD:
Used with HTML formatting tags. Use with browsers that don't support CSS
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3/org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
FRAMESET DTD:
Used with
HTML frames
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3/org/TR/xhtml1/DTD/xhtml1-frameset.dtd">