css| Beginner | Browser DOCTYPE document types often confuse the novice, what exactly is this thing. In fact, this is only a set of machine-readable programming, although the middle contains the file URL, but the browser will not read these files, just for identification. Then decide what kind of planning to execute the code on the page.
A DTD is a document type definition that defines a specific version of XML, XHTML, HTML, what you can have, what you can't have, and when you load a Web page, the browser uses an established statement to plan to check the content of the page, whether it's valid, or illegal, Then take the appropriate measures and coding to interpret the code in the document.
We do not go into the deep understanding of what it is work, because it has gone beyond the scope of this site. We must know it is very necessary! Without it, there may be some anomalies in our page. Often a novice wrote the code, according to the tutorial to operate, there is no one letter deviation, but found that the appearance of the show is completely wrong. This should check that the DOCTYPE document type is correct. Most can solve the problem!
We develop web-standard Web sites, we must specify a doctype for our XHTML, otherwise CSS may be applied with errors. Let's take a look at some of the types we use:
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 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 ">
Strict (Strict): Requires a strict DTD, you can not use any performance layer of identification 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. 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" >
In general, we choose the "Transition (transitional)", the DTD is more relaxed, it is easier to pass the code of the World of the world, more suitable for the current domestic environment and the level of most developers. Of course, our goal is to work toward the "strict (Strict)" direction.
In addition, we find that there is another code in some documents:
This "xmlns" is an abbreviation of the XHTML namespace, called a "namespace" declaration. XHTML is an identity language that HTML transitions to XML, and it needs to conform to the rules of XML documents, so it also needs to define namespaces. And because XHTML1.0 cannot customize the identity, it has the same name space, which is "http://www.w3.org/1999/xhtml". If you do not understand it does not matter, at this stage we just copy the code can be.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.