DOCTYPE is a shorthand for document type, which is used to describe what version of XHTML or HTML you are using.
The DTD (for example, XHTML1-TRANSITIONAL.DTD) is called the document type definition, which contains the rules of the document, and the browser interprets the identity of your page according to your defined DTD and shows it.
The DOCTYPE statement is an essential part of establishing a standard-compliant web page, and your logo and CSS will not take effect unless your XHTML determines the correct doctype.
XHTML 1.0 provides three types of DTD declarations to choose from:
1 Transition (transitional): A very liberal DTDis required, which allows you to continue using HTML4.01 's identity ( but to conform to the XHTML notation ).
The complete code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> |
2 Strict (Strict): requires a strict DTD, you cannot use any of the presentation layer's identities and attributes, such as <br>.
The complete code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > |
3 Framework (Frameset): The DTD used specifically for frame page design , if your page contains frames, you need to use this DTD.
The complete code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" > |
Note :D the Octype declaration must be placed at the top of every XHTML document, above all code and identities.
What kind of doctype is right for your Web page?