HTML DOCTYPE tag

HTML DOCTYPE tag

What Doctype yes? Click to view Detailed

  • <!DOCTYPE> Statement help browsers display pages correctly.

  • web presence in the world with a lot of different documents, only by understanding the type of document, the browser can correctly display the document. That's <!DOCTYPE> usefulness.

  • <! DoCTYPE> html tag is not, it provides a message (statement) for the browser, which is written in HTML what version.

  • All browsers support <!DOCTYPE>the statement.

Examples

HTML document with the HTML5 DOCTYPE:

<!doctype html>
<html>
    <head>
        <title>Title of the document</title>
    </head>
    <body>
    The content of the document......
    </body>
</html>

HTML version Development

From the birth of the early Web so far, it has developed multiple versions of HTML:

version years
HTML 1991
HTML+ 1992
HTML2.0 1995
HTML3.2 1997
HTML 4.01 1999
XHTML 1.0 2000
HTML5 2012
XHTML5 2013

Definition and Usage

Tip: Always add to the HTML document <!DOCTYPE>declaration, so that the browser can know the type of document.

  • <!DOCTYPE> Declaration must be the first line of HTML documents located in <html> tag before

  • <!DOCTYPE> Not the html tags, it is just a web browser instructions about which HTML version written by the line

  • In the HTML 4.01, <! DOCTYPE> declaration referenced DTD, since HTML 4.01 based on SGML . DTD specifies the rules markup language, so the browser to render content correctly.

  • HTML5 is not based on SGML, so no reference DTD.

The difference between 4.01 and HTML5 HTML
, there are three in the HTML 4.01 <! DOCTYPE> declaration. Only one in HTML5:

<!DOCTYPE html>

Click to view HTML table elements , which lists each element which appears in the document type.

Tips and Notes

  • Note: <!DOCTYPE>The statement did not end tag.

  • Tip: <!DOCTYPE>statements are not case sensitive.

  • Tip: Use the W3C validator to check whether you write valid HTML / XHTML document!

Common DOCTYPE declaration

HTML5

<!DOCTYPE html>

HTML 4.01 Strict
the html DTD contains all elements and attributes, but not illustrative and elements (such as font) is enabled, the frame is not allowed Framesets.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

HTML 4.01 Transitional
The HTML DTD contains all elements and attributes, including illustrative and deprecated elements (such as font). Do not allow frameset (Framesets)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">

HTML 4.01 Frameset
the equivalent DTD HTML 4.01 Transitional, but set to allow the contents of the frame.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
"http://www.w3.org/TR/html4/frameset.dtd">

XHTML 1.0 Strict
the HTML DTD contains all elements and attributes, but do not include illustrative and deprecated elements (such as font). Do not allow frameset (Framesets). You must be well-formed XML to write the tag

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

XHTML 1.0 Transitional
The HTML DTD contains all elements and attributes, including illustrative and deprecated elements (such as font). Do not allow frameset (Framesets). You must be well-formed XML to write the tag.

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

XHTML 1.0 Frameset
the equivalent DTD XHTML 1.0 Transitional, but set to allow the contents of the frame.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

XHTML 1.1
This is equivalent to the DTD XHTML 1.0 Strict, but allows to add the model (e.g., to provide support for East Asian languages of ruby).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Guess you like

Origin www.cnblogs.com/jlfw/p/12653774.html