What kind of doctype is right for your Web page?

Source: Internet
Author: User

DOCTYPE is a shorthand for document type, which is used to describe what version of XHTML or HTML you are using.

The DTD (for example, XHTML1-TRANSITIONAL.DTD) is called the document type definition, which contains the rules of the document, and the browser interprets the identity of your page according to your defined DTD and shows it.

The DOCTYPE statement is an essential part of establishing a standard-compliant web page, and your logo and CSS will not take effect unless your XHTML determines the correct doctype.

XHTML 1.0 provides three types of DTD declarations to choose from:

1 Transition (transitional): A very liberal DTDis required, which allows you to continue using HTML4.01 's identity ( but to conform to the XHTML notation ).

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 ">

2 Strict (Strict): requires a strict DTD, you cannot use any of the presentation layer's identities and attributes, such as <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" >

3 Framework (Frameset): The DTD used specifically for frame page design , if your page contains frames, 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" >

Note :D the Octype declaration must be placed at the top of every XHTML document, above all code and identities.

What kind of doctype is right for your Web page?

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.