www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons XHTML DOCTYPE declaration Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
All XHTML documents must have one root element i.e. <html>. All other tags / elements must be enclosed within <html> and </html>. If not, the document may still be a valid HTML document, but it will no longer be a valid XHTML document.

A valid XHTML document must have a DOCTYPE declaration. In addition html, head, title, and body elements must also be present.

A PROPER XHTML DOCUMENT:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Title of document</title>
</head>
<body>
Body contents of the document.
</body>
</html>


You must be familiar with the html, head, title and body tags. The <!DOCTYPE> declaration refers to a Document Type Definition (DTD). A DTD specifies the rules for the markup language, so that the browsers can render the content correctly. This declaration is not an XHTML tag, on the other hand it is an instruction to the web browser about the version of the markup language the current page is written in.

Note: If you need to understand more about DTDs, you need to learn XML. For the XHTML learners it is sufficient to know that every XHTML document starts with the <!DOCTYPE> declaration.

Following is list of different XHTML dtds with a short description, so you could decide which dtd to use:

XHTML 1.0 Strict:

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

Contains all HTML elements and attributes, but NOT presentational or deprecated elements (like font). Framesets not allowed.

XHTML 1.0 Transitional:

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

Contains all HTML elements and attributes, also presentational and deprecated elements (like font). Framesets not allowed.

XHTML 1.0 Frameset:

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

This DTD is the same as XHTML 1.0 Transitional, but allows the use of framesets.

XHTML 1.1:

This DTD is the same as XHTML 1.0 Strict, but allows you to add modules (A concept out of the scope of this tutorial).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

For more information about the different XHTML DTDs go to http://w3c.org


Next >>> Lesson No. 7: XHTML Common Mistakes




Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.