DOCTYPE is short for document type. It is used to describe the XHTML or HTML version you use in web design.
To create a standard web page, the DOCTYPE Declaration is an essential part. Your logo and CSS will not take effect unless your XHTML determines a correct DOCTYPE.
DOCTYPE Declaration
Start to make a site that meets the standards. The first thing is to declare the DOCTYPE that meets your needs.
View many websites developed using the XHTML standard. The first line is:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Open some standards-compliant sites, such as the famous web design software developer Macromedia, web Tao bar, will find the same code.
The code for other websites that comply with the standards is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Frameset // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
So what do these codes mean? Are you sure you want to place it?
What is DOCTYPE?
The above code is called the DOCTYPE declaration. DOCTYPE is short for document type. It is used to describe the XHTML or HTML version you are using.
The DTD (such as the xhtml1-transitional.dtd in the above example) is called the document type definition, which contains the document rules, the browser according to your definition of the DTD to explain your page identity and display.
To create a standard web page, the DOCTYPE Declaration is an essential part. Your logo and CSS will not take effect unless your XHTML determines a correct DOCTYPE.
XHTML 1.0 provides three types of DTD declarations:
* Transitional: a very loose DTD that allows you to continue using the HTML4.01 identifier (but in line with 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: a Strict DTD. You cannot use any identifier or attribute of the performance layer, for example, <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: a dtd designed specifically for the Framework page. If your page contains a framework, 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">
What DOCTYPE should we choose?
The ideal situation is of course a strict DTD, but for most of our designers who are new to web standards, the Transitional DTD (XHTML 1.0 Transitional) is currently the ideal choice. Because this DTD also allows us to use the identifier, element, and attribute of the presentation layer, it is easier to pass W3C code verification.
Note: The "presentation layer identifier and attribute" mentioned above refers to the tags purely used to control the presentation, such as the table used for typographical layout and background color identifier. In XHTML, identifiers are used to represent structures rather than representations. Our purpose of transition is to ultimately separate data from representations.
For example, a human model changes clothes. Models are like data. clothes are the form of representation. Models and clothes are separated so that you can change clothes at will. In HTML4, data and performance are mixed, and it is very difficult to change the form at one time. It's a bit abstract. We need to gradually understand this concept in the application process.
Supplement
The DOCTYPE Declaration must be placed at the top of each XHTML document, on top of all codes and identifiers.
The Declaration at the beginning of the html/web/'> webpage may be of little concern to us. Next I will write down my understanding based on the online materials. please correct me more.
Some website source code starts
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
Some website source code starts
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml" lang = "UTF-8">
The beginning of the source code of the two web pages is basically the same, the former is more than the latter's html xhtml Web Page code this page has a lang = "UTF-8"
1. What is DOCTYPE?
DOCTYPE is short for document type. It is used to describe the XHTML or HTML version you are using.
Html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN"
Indicates that the webpage complies with W3C // standard. The language is EN, the format is dtd xhtml, And the Xhtml version is 1.0.
2. What is a DTD?
Document Type Definition)
It contains the document rules, and the browser will explain the logo of your page according to your defined DTD and display it.
(1) Transition type (Transitional)
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
(2) Strict)
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
(3) Framework (Frameset)
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Frameset // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
The selection of DTD will be followed by post instructions.
3. What is xmlns?
"Xmlns" is the abbreviation of XHTML namespace, called "namespace" Declaration
Because xml allows you to define your own identifiers, the identifiers you define may be the same as those defined by others, but they indicate different meanings. Errors may occur when files are exchanged or shared. To avoid such errors, XML uses namespace declarations, allowing you to identify your identity through a Web site.
4, xmlns = "http://www.w3.org/1999/xhtml" after the Web site can be changed to another?
XHTML is the identifier language for the transition from HTML to XML. It must comply with XML document rules, so you also need to define the namespace. Because XHTML1.0 cannot customize the identity, so its namespace is the same, is the http://www.w3.org/1999/xhtml
5. html lang attributes
This attribute is often used in html tags to indicate that the entire document (File) uses a certain language, or in an XHTML tag.
<Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "zh-CN">
Zh-CN indicates that the XHTML document uses Chinese en to indicate that the XHTML document uses English
The xml: lang attribute allows the search engine to understand the language in which your page is used. The search engine can classify pages by language or start some automatic translation systems. the xml: lang attribute can also enable the typographical tool to know the language in which your page is used, so that the corresponding typographical tool can switch between punctuation marks, conversion formats, and other operations.
In the original webjx code, is lang = "UTF-8" correct? My understanding is that UTF-8 is an encoding format, and the lang attribute value should be a string that represents the language type. Which teacher should explain it.