In HTML, the beginning of the web page code is "<!DOCTYPE html>"; this code is the "" statement, which is the document declaration header and is used to describe the HTML used. Which version will be placed at the front of the document code, before the "" tag.
The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
Document declaration header
For a standard HTML page, the first line is a statement starting with, this is The document declaration header is DocType Declaration, or DTD for short. DTD can tell the browser which HTML or XHTML specification to use.
doctype is the abbreviation of Document Type, which is used to indicate what version of HTML is used. Placed at the top of the document
declares the frontmost position in the document, before the tag. The
declaration is not an HTML tag; it is used to tell the web browser which version of HTML is used for the page.
In HTML 4.01, the declaration needs to reference the DTD (Document Type Declaration) because HTML 4.01 is based on SGML (Standard Generalized Markup Language). DTD specifies the rules of the markup language to ensure that the browser can render the content correctly.
HTML5 is not based on SGML and therefore does not require DTD reference.
Tip: Always add the declaration to your HTML document to ensure the browser knows the document type in advance.
HTML 4.01 specifies three different declarations: Strict, Transitional, and Frameset. Only one type is specified in HTML5:
<!DOCTYPE html>
Examples are as follows:
Common DOCTYPE declaration
HTML 5
<!DOCTYPE html>
HTML 4.01 Strict
This DTD contains all HTML elements and attributes, but does not include presentational or obsolete elements (such as font). Framesets are not allowed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
This DTD contains all HTML elements and attributes, including presentational or obsolete elements (such as font ). Framesets are not allowed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
(Learning video sharing: css video tutorial, html video tutorial)
The above is the detailed content of What does the html web page code begin with?. For more information, please follow other related articles on the PHP Chinese website!