When we open the source code of a regular website, we will find that the source code must start with <!DOCTYPE html, and some of them have a direct > after <!DOCTYPE>, while others have very long text, such as <!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"> Of course, the more mainstream web page source codes, such as E-dimensional Technology source code, all use HTML5 format and start directly with <!DOCTYPE html>. <!DOCTYPE html> is not an HTML tag, it is just a browser instruction that tells the browser which version of the markup to use to write the page, so it does not need to appear in pairs. <!DOCTYPE html> is not case-sensitive in any version, but it is customary to write it as “<!DOCTYPE html>”. Of course, in order to comply with W3C standards, it can also be written as “<!doctype html>”.
DOCTYPE means document type in English, which is the version type declaration of HTML. HTML did not have any standards at the beginning, and then went through the more popular HTML4, and then entered the HTML5 era. The standards of each period were different. For example, in earlier versions of HTML, <br> line breaks could not be implemented. This is because HTML tags must appear in pairs, so they must be represented by <br/>. However, in the later period of HTML4, this concept has become very vague, and it is the same whether it ends with "/" or not. However, HTML 5 stipulates that there is no need to use “/”, and you can just use <br>. Such a confusing interpretation method requires telling the browser the version specification used by the HTML encoding of the current web page. It is very important to specify a DOCTYPE in all HTML documents so that the browser knows what document type to expect. The DOCTYPE in HTML 4.01 requires a reference to a DTD because HTML 4.01 is based on SGML. HTML 5 is not based on SGML, so it does not need to reference DTD, but it needs doctype to regulate the behavior of browsers (so that browsers can run in the way they should). HTML version statementHTML 5 does not have any document types, but it is best to avoid using frames; XHTML 1.0 specifies three XML document types: Strict, Transitional, and Frameset; HTML 4.01 specifies three document types: Strict, Transitional, and Frameset. HTML 5 Specification StatementThe expression is very concise, with only one attribute: the root element is html <!DOCTYPE html> XHTML 1.0 Strict DTDUse this type if you need clean markup, free from the clutter of the presentation layer. Please use with Cascading Style Sheets (CSS): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> In the above declaration, it is stated that the root element of the document is html, which is defined in the DTD whose public identifier is defined as "-//W3C//DTD XHTML 1.0 Strict//EN". The browser will know how to find a DTD that matches this public identifier. If it can't find it, the browser uses the URL following the public identifier as the location to look for the DTD. XHTML 1.0 Transitional DTDTransitional DTDs can contain presentation attributes and elements that the W3C expects to be moved into style sheets. Use this style if your readers use browsers that do not support Cascading Style Sheets (CSS) and you are forced to use the rendering features of XHTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> XHTML 1.0 Frameset DTD FramesetUse this DTD when you want to use frames! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> HTML4.1 Transitional DTDTransitional DTDs can contain presentation attributes and elements that the W3C expects to be moved into style sheets. Use this type if your readers use browsers that do not support Cascading Style Sheets (CSS) and you are forced to use the rendering features of HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd"> HTML4.1 Strict DTDUse this type if you need clean markup, free from the clutter of the presentation layer. Please use with Cascading Style Sheets (CSS): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd"> HTML 4.01 Frameset DTD Frame DocumentThe Frameset DTD should be used for documents with frames. The Frameset DTD is identical to the Transitional DTD, except that the frameset element replaces the body element: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" " http://www.w3.org/TR/html4/frameset.dtd"> |
<<: Some common advanced SQL statements in MySQL
>>: js, css, html determine the various versions of the browser
Table of contents 1. The default focus is on the ...
1. First, create a hello-world.cpp file The progr...
Grammatical rules SELECT column_name(s) FROM tabl...
Operation effect: html <div class="tic-ta...
Defining an array in Bash There are two ways to c...
As one of the most commonly used and important ut...
1. flex-direction: (direction of element arrangem...
Table of contents environment: 1. Docker enables ...
Preface The reason for writing this article is mai...
Table of contents Data volume Anonymous and named...
This article shares the specific code of vue+elem...
describe: Install VM under Windows 10, run Docker...
In centos7, the permissions of the /etc/rc.d/rc.l...
This article example shares the specific code of ...
Check virtualization in Task Manager, if it is en...