XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and...

Preview:

Citation preview

XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version of

HTML XHTML is HTML defined as an XML

application

The rules for writing XHTML documents are:

All tag and attribute names must be in lowercase

"Empty" tags must be written with an extra slash at the end

You can never omit an end tag

Attributes must always have a value

Attributes values must always be quoted

LEGACY HTML

<A HREF=“index.html"> ...</A>

XHTML

<a href=“index.html">...

</a>

LEGACY HTML

<img src="foo.html">

XHTML

<img src="foo.gif” />

LEGACY HTML

<p> ..... paragraph text <p> ..... more paragraph text

XHTML

<p> ..... paragraph text </p><p> ..... more paragraph text </p>

LEGACY HTML

<hr size="2” noshade>

XHTML

<hr size="2" noshade="noshade" />

LEGACY HTML

<hr size=2>

XHTML

<hr size="2" />

XHTML elements must be properly nested, be closed, be in lowercase, and be nested within the <html> root element

Attribute names must be in lower case, values must be quoted

The id attribute replaces the name attribute

The XHTML DTD defines mandatory elements

All XHTML documents must have a DOCTYPE declaration.

The html, head , title, and body elements must be present

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>simple document</title> </head><body> <p>a simple paragraph</p></body></html>

An XHTML DTD describes in precise, computer-readable language, the allowed syntax and grammar of XHTML markupStrict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Use this when you want clean markup, free of presentational clutter. Use this together with CSS.

Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Use this when you need to take advantage of HTML's presentational features and when you want to support browsers that don't understand CSS.

Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Use this when you want to use HTML Frames to partition the browser window into two or more frames.

Recommended