By default, the interpretation standards of FF and IE are different. That is to say, if a web page does not declare DOCTYPE, it will interpret the following with the default DOCTYPE HTML. Under the same standard, the interpretation models of different browsers are different. If the declaration standards are different, I don't need to tell you, just think about it yourself. Learn web standards and browser compatibility. You decide where to start. However, please understand DOCTYPE
## 1. What is DOCTYPE
DOCTYPE is the abbreviation of Document Type. In the page, it is used to specify the version of XHTML (or HTML) used by the page. To create standards-compliant pages, an essential and key component is the DOCTYPE declaration. Only by determining a correct DOCTYPE can the logo and CSS in XHTML take effect normally.2. The rules of DOCTYPE
The writing method of DOCTYPE declaration follows certain rules, which indicates what set of rules the reading program should use to interpret the document mark in . In the case of Web documents, the "reader" is usually a program such as a browser or a validator, and the "rules" are the rules contained in a document type definition (dtd) published by the W3C.Each dtd includes tags, attributes, properties, etc., which are used to mark the content of web documents; it also includes some rules that specify which tags can appear in which other tags. Each web recommendation standard (such as HTML 4 Frameset and XHTML 1.0 Transitional) has its own DTD.
- Availability: Specifies whether the Formal Public Identifier (FPI) is a publicly accessible object or a system resource. PUBLIC Default. Publicly accessible objects. SYSTEM System resources, such as local files or URLs.
- Registration: Specifies whether the organization is registered by the International Organization for Standardization (ISO). + Default. The organization name has been registered.
- The organization name is not registered. The Internet Engineering Task Force (IETF) and the World Wide Web Consortium (W3C) are not registered ISO organizations.
Organization: Specify the name of the group or organization responsible for the creation and maintenance of the DTD referenced by the !DOCTYPE declaration, that is, the OwnerID. IETF IETF. W3C W3C.
- Type: Specifies the public text class, that is, the type of object being referenced. DTD default. DTD.
- Tag: Specifies a public text description, a unique, descriptive name for the public text being referenced. A version number can be attached at the back. HTML default. HTML.
- Definition: Specifies the document type definition.
Frameset Frameset document.
Strict excludes all representative attributes and elements that W3C experts want to phase out because the style sheet is already well established.
Transitional contains all contents except frameSet elements.
- Language: Specifies the public text language, the natural language encoding system used to create the referenced object. The language definition has been written as an ISO 639 language code (uppercase two letters). EN default. English.
- URL: Specify the location of the referenced object
3. What kind of DOCTYPE to choose
As shown in the above example, there are 3 types of DTD (Document Type Definition) declarations in XHTML 1.0 Choose from: Transitional, Strict, and Frameset. They are introduced here as follows.1. Transitional
A DTD with less stringent requirements that allows the use of HTML4.01 logos in pages (complying with xhtml syntax standards). The transitional DTD is written as follows: The code is as follows:"http:/ /www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2. Strict
A strict DTD that does not allow the use of any presentation layer identifiers and attributes, such as3. Frame
A DTD specifically used for frame pages. This DTD is used when the page contains frame elements. The DTD of the framework is written as follows: The code is as follows:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset .dtd">
Using strict DTD to create pages is of course the most ideal way. However, for web designers who do not have a deep understanding of web standards, it is more appropriate to use a transitional DTD. Because this DTD also allows the use of presentation layer identifiers, elements and attributes, it is more suitable for most web page developers.
4. Issues that need attention
Nothing special, that is, the DOCTYPE statement must be placed at the top of the XHTML document, even if there are more None of the HTML comment tags work.
It is best to add DOCTYPE to the sample code, otherwise the effect will be different.
Just read this article. Many programming tools are now automatically generated, or generated using shortcut keys.
Related recommendations:
Why use DOCTYPE HTML_HTML/Xhtml_Web page production
Learning about _html/css_WEB-ITnose
## declares that the div height is 100% Problem solving method
The above is the detailed content of DOCTYPE html is important. For more information, please follow other related articles on the PHP Chinese website!