Both HTML and XHTML has there versions of DTD: strict, transitional and frameset. Strict DTD omits all the presentation attributes and elements. This DTD is used if you wish to have a clean presentation and take advantage of using cascading style sheets. Transitional DTD is the opposite strict DTD. This DTD is used if you wish to take advantage of the presentation features of HTML and when you want to support older web browsers that don't actually support cascading style sheets. Frameset DTD is used for documents with HTML frames
Here's how to declare the various versions of DTD for both HTML and XHTML:
1. HTML 4.01 Strict DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
2. HTML 4.01 Transitional DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
3. HTML 4.01 Frameset DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
4. XHTML 1.0 Strict DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5. XHTML 1.0 Transitional DTD
<!DOCTYPE html PUBLIC "-//W#C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6. XHTML 1.0 Frameset DTD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
Here's how you should used the <!DOCTYPE> element:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equive="Content type" content="text/html ;
charset=utf-8" />
<title>Document Type Definition Example</title>
</head>
<body>
<h1>
Document Type Definition Example
</h1>
</body>
</html>,
<!DOCTYPE> tag must always be placed at the beginning of an HTML document. But when an XML declaration, such as <?xml version="1.0">, is present, <!DOCTYPE> tag must be placed after the XML declaration.
1 comments:
now i understand this document type. thank you for this.
Post a Comment