HTML & lt ;! DOCTYPE & gt; declaration function, doctype Declaration

Source: Internet
Author: User

HTML <! DOCTYPE> role of the Declaration, doctype Declaration

On the html page, what is the use of the following line of code?

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


In a page reconstruction process, the first line of the Static Page has such a piece of code, followed by a large blank area. When the blank area is deleted, this line of code is accidentally deleted, then ....

It turns out that the normal page is messy and the font style is gone. The key is to take a look at the web browser. The layout is totally misplaced, I couldn't find the reason after searching for a long time. Fortunately, the original file was backed up and compared with it. This line of code was a bit strange, and I learned a bit about it, why is it used?

<! DOCTYPE> declares the position at the beginning of the document, before the

Function of doctype
The doctype statement specifies the rule set used by the reader to explain the markup in the document. In the case of web documents, "reading program" is usually a program such as a browser or a checker, and "rule" is a document type definition (dtd) published by w3c).
Each dtd contains a series of tags, attributes, and properties, which are used to mark the content of a web document; in addition, they include rules that specify which tags can appear in other tags. Each web Recommendation Standard (such as html 4 frameset and xhtml 1.0 transitional) has its own dtd.
If the tag in the document does not follow the dtd specified by the doctype Declaration, this document may not be correctly displayed in the browser in addition to code verification. For the mark inconsistency problem, the browser is more tolerant than the validator. However, incorrect doctype statements often result in incorrect webpage display, or they cannot be displayed at all.



Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.