One, HTML doctype function
DOCTYPE is a shorthand for document type, which is used in web design to illustrate the version of XHTML or HTML that you use.
To build compliant XHTML Web pages, DOCTYPE declarations are an essential part of the key; unless your XHTML determines a correct doctype, your identity and CSS will not work.
Be sure to place the top of the HTML page code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//cn" "HTTP://WWW.W3. Org/tr/xhtml1/dtd/xhtml1-transitional.dtd ">
Summary, the usual HTML DOCTYPE declaration is necessary, and the use of DIV+CSS is essential, if the lack or error document will cause your CSS invalidation or semi-invalidation, that is, because CSS invalidation, Web page layout chaos, some CSS properties can not be reflected.
Second, DOCTYPE HTML selection
XHTML 1.0 offers three types of DTD declarations to choose from:
* Transition (Transitional): A very loose DTD that allows you to continue using HTML4.01 's identity (but to conform to XHTML), 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 ">
* Strict (Strict): Requires a strict DTD, you can not use any of the presentation layer of the identity 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" >
* Framework (Frameset): A DTD specifically designed for frames page design, if your page contains frames, you need to use this DTD, complete code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >
What kind of doctype do we choose?
Ideally, of course, a strict DTD, but for most of us who have just come in contact with Web standards, the transition DTD (XHTML 1.0 Transitional) is the ideal choice now. Because the DTD also allows us to use the identity, elements, and attributes of the presentation layer, it is also easier to pass the code checksum of the consortium.
Note: The above "performance layer identification, attributes" refers to those who are purely used to control the performance of the tag, such as the table used for typesetting, background color identification. The identity in XHTML is used to represent structs, not to implement representations, and the purpose of our transition is to ultimately achieve separation of data and performance.
For example, a mannequin changes clothes. Models are like data, clothes are representations, models and clothes are separate, so you can change clothes at will. The original HTML4, the data and performance is mixed together, it is very difficult to change the form of a one-time. Oh, a little abstract, this concept requires us to gradually understand in the application process.
Add
The DOCTYPE declaration must be placed at the top of every XHTML document, above all code and logo.
iii. doctype shorthand for transition
HTML DOCTYPE Top code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
can be abbreviated as:
<! DOCTYPE html>
Note: The source and origin of the article URL: http://www.divcss5.com/html/h22.shtml