Vectorials
Flash Perfection
3D Lessons
Tutorialkit
Markup Tutorials
Learn PHP
network
adv banner
HTML and CSS  Home HTML and CSS Tutorials HTML vs. XHTML
rss

HTML vs. XHTML

Author: PiticStyle More by this author


XHTML 1.0 is a reformulation of HTML 4.0. What this really means is that learning XHTML is basically the same as learning HTML. The main difference is a few simple rules - as XHTML is more strict than standard HTML.

1. Stricter adherence to the HTML specification

Many browsers are very lax in how they interpret HTML. This leads to incongruities in how the pages are displayed, and XHTML doesn't allow that. The best way to correct this is to use an XHTML validator such as HTML Tidy.

2. Write well formed documents

What this generally means is avoiding overlapping elements. The following nested code is acceptable: <p>Paragraph <em>emphasized</em></p> because the <em> tag is opened and closed within the <p> tag. However, this is not allowed: <p>Paragraph <em>emphasized</p></em> because the <em> tag overlaps the <p> tag.

3. Write tags and attributes in lowercase

XHTML is a case-sensitive markup language, so <LI> and <li> are potentially two different elements.

4. End tags are required

In HTML, some tags which actually contain elements do not require the end tag.

The most common of these is the <p> tag. XHTML requires that the </p> tag be used. For singleton tags, such as <br> you should include a trailing slash in the tag itself, e.g. <br />

5. Attributes must be quoted and include values

What this means is that non-quoted attributes such as <table border=3> are invalid. And attributes which used to stand alone, must now be written as name="value" pairs. For example <br noshade="noshade" />

image 1vsimage 2



Author's URL: www.piticstyle.com

Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "HTML vs. XHTML"