What is doctype for the XHTML header declaration?

Source: Internet
Author: User
Tags color identifier

When we create a page, we will always see a declaration in its source code header, for example, the most common

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

If we put theseCodeRemoved, the page may be significantly changed, because it causes some styles to behave differently.

These codes are called the doctype declaration. Doctype is short for document type. It is used to describe the XHTML or html version you are using. The doctype Declaration must be placed at the top of each XHTML document, on top of all codes and identifiers.

The DTD (such as the xhtml1-transitional.dtd in the above example) is called the document type definition, which contains the document rules, the browser according to your definition of the DTD to explain your page identity and display.

To create a standard web page, the doctype Declaration is an essential part. Your logo and CSS will not take effect unless your XHTML determines a correct doctype.

XHTML 1.0 provides three types of DTD declarations:

Transitional: requires a very loose DTD, which allows you to continue using the html4.01 logo (but it must conform to the XHTML syntax ). 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">

Strict: a strict DTD is required. You cannot use any identifier or attribute of the performance layer, such
. 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">

Framework: a dtd designed specifically for the Framework page. If your page contains a framework, 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">

The ideal situation is of course a strict DTD, but for most of our designers who are new to web standards, the transitional DTD (XHTML 1.0 transitional) is currently the ideal choice. Because this DTD also allows us to use the identifier, element, and attribute of the presentation layer, it is easier to pass W3C code verification.

Note: The "identifier and attribute" of the presentation layer refer to the tag tags that are purely used to control the presentation, such as the table used for typographical layout and the background color identifier, and some internal styles. In XHTML, identifiers are used to represent structures rather than representations. Our purpose of transition is to ultimately separate data from representations.

The structure and performance are separated. The XHTML tag on the page is used to represent the structure, and its representation is controlled by the CSS style. Unconsciously speaking of standardized structure separation. The header declaration mentioned above is only the basic knowledge and the basis of the page. It is the first step for you to start building your page with XHTML.

This articleArticleFrom <a href = 'HTTP: // www.soidc.net '> IDC Expert Network </a> Source: http://www.soidc.net/articles/1213781627945/20070515/1214037411193_1.html

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.