HTML Tutorial: Web standards starting from scratch

Source: Internet
Author: User
Tags definition requires

On earlier pages, we can often see the following page structure code:

<title>这是一个网页</title>
<meta name=”…” content=”…” />
……
<body>
……
</body>

Obviously, the Web code for this kind of structure is not in line with the standards of the website, but the browser can still present the page well, as long as there is nothing wrong with the code. This is actually like using a table layout of the page with the Div frame of the page, the browser can be presented, the key is which page to render the quality will be higher.

Make a page, with a good page, the middle has a very distant distance.

In the course of the browser's development, Microsoft's Internet Explorer bundled into the Windows operating system, has never become the dominant browser market, resulting in a series of IE on the organization's web standards in disregard of things, Microsoft's IE has always followed its own web standards. Thankfully, Microsoft has decided to support Web standards in his IE8, although it is not yet finalized. In addition to Microsoft's IE, Mozilla Firefox, Apple Safari, Opera, Chrome and other browsers in the name of supporting web standards and IE do a long confrontation.

browsers, which creates a difference in the default parsing of HTML code, so even if the same code could be different in different browsers, it would require a common browser-compliant rule to reconcile the differences between browsers, a rule that requires a declaration to refer to it, This declaration is the Doctype--document type (document type).

DOCTYPE declarations are an essential part of a standard Web page, so to create a Web page that meets the standards of the Internet, you first need to declare a document type for this page. The DTD (document type definition) declared by DOCTYPE is divided into three categories, respectively:

Transitional (Transition): Requires a DTD that is not very strict, allowing you to continue using HTML4.01 tags on the page;

Strict (Strict): This is the ideal DTD for making pages, but this document type definition does not allow the use of tags and attributes on any of the presentation layers;

Frameset (framework): This is specifically for the page design contains a framework DTD.

Because the design of frame type may be included in the search engine, many Web pages do not use frame design, and strict DTD is an idealized way for most people; The transitional DTD is the most applicable and widely used document type definition at the moment. Now you can open a Web page that meets the standards of your website, and you'll see a statement at the beginning of the page:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

This is a DOCTYPE statement about the XHTML Web page document. Of course it's not that the DOCTYPE declaration is for XHTML Web documents only, and for Web documents that use HTML4.01, you can also use DOCTYPE declarations:

DTD for Transition:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >

A strict DTD:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >

The only thing to note is that the location of the DOCTYPE declaration must be at the very beginning of the page, and no code or label can appear until the DOCTYPE is declared, otherwise the label or CSS style in the page may be invalidated.

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.