About HTML5 entry to mastery: <! Doctype> Label

Source: Internet
Author: User
Keywords tags HTML5 Getting started to master

<! Doctype> Label

Definitions and usage

<! The doctype> declaration must be in the first line of the HTML 5 document, before the <html> label. The label tells the HTML specification used by the browser's document.

DOCTYPE declaration does not belong to HTML tags; It is an instruction that tells the browser the version of the markup used to write the page.

It is important to specify DOCTYPE in all HTML documents so that the browser can understand the expected document type.

DOCTYPE in HTML 4.01 need to refer to DTDs because HTML 4.01 is based on SGML. While HTML 5 is not based on SGML, there is no need to refer to DTDs, but DOCTYPE is needed to regulate the behavior of browsers (let browsers run the way they should). )。

Instance

HTML 5 document with the correct document type (DOCTYPE):

<! DOCTYPE html>
<html>
<head>
<title>title of the Document</title>
</head>
<body>
The content of the document ...
</body>
</html>

Try the following code yourself.

<! DOCTYPE html>
<html>
<head>
<title>title of the Document</title>
</head>
<body>
The content of the document ...
</body>
</html>

Differences between HTML 4.01 and HTML 5

There are 3 different document types in HTML 4.01, and only one in HTML 5:

<! DOCTYPE html>

In HTML 5, document type declarations are not straightforward.

Tips and Comments:

Note: <! doctype> tag has no end tag!

Hint: <! Doctype> is not sensitive to case.

Property

NONE

Definitions and usage

<a> label defines hyperlinks for linking from one page to another.

The most important attribute of the <a> element is the href attribute, which specifies the target of the link.

In all browsers, the default appearance of the link is:

Links that are not accessed are underlined and blue

Links that have been accessed are underlined and purple

Active links are underlined and red

Instance

Link to Sina:

<a href= "http://www.sina.com.cn" >Sina</a>
Try it for yourself.
<! DOCTYPE html>
<html>
<body>
<a href= "http://www.sina.com.cn" >visit sina.com.cn!</a>
</body>
</html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.