Day 1th: What doctype_ basic tutorials to choose

Source: Internet
Author: User

Objective

Hello everyone! This series of articles was written according to Ateptsevo's own process of making the site. Ateptsevo has never produced a website that really meets web standards. Now the side of the reference to foreign materials production, while the process of experience and experiences recorded, I hope that a little help. Okay, let's get started.

First day

Start making a site that conforms to the standard, and the first thing is to declare the DOCTYPE that suits your needs.

View the home page of the original code, you can see the first line is:

Open some standards-compliant sites, such as the famous web design software developer Macromedia, design guru Zeldman's personal site, will find the same code. The code for other standards-compliant sites (for example, K10k.net) is as follows:

So what does this code mean? Must you place it?

What is DOCTYPE

The above code we call the DOCTYPE statement. 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 in the previous example) is called the document type definition, which contains the rules of the document, and the browser interprets the identity of your page according to the DTD you define 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:

    • Transition (Transitional): A very liberal DTD that allows you to continue to use HTML4.01 's identity (but to conform to XHTML notation). The complete code is as follows:

    • Strict (Strict): Requires strict DTD, you cannot use any of the presentation layer's identities and attributes, for example
      。 The complete code is as follows:

    • Framework (Frameset): A DTD used specifically for frame page design, if your page contains frames, you need to use this DTD. The complete code is as follows:

What kind of doctype do we choose?

The ideal scenario is of course a strict DTD, but for most of us who are new to Web standards, the transition DTD (XHTML 1.0 Transitional) is the ideal choice (including this site, which is also a transitional DTD). Because this DTD also allows us to use the identity, elements and attributes of the presentation layer, it is also easier to pass the code validation.

Note: The above-mentioned "performance layer identification, attributes" refers to those purely to control the performance of the tag, such as the table for typesetting, background color identification. In XHTML, identities are used to represent structures rather than to implement representations, and the purpose of our transition is ultimately to achieve separation of data and representation.

Make an analogy: the mannequin changes clothes. Models are like data, clothes are expressions, models are separated from clothes, so you can change your clothes. In the original HTML4, the data and performance are mixed together, it is very difficult to change the form of the expression at once. Oh, a bit abstract, this concept requires us to gradually understand the application process.

Add

The DOCTYPE declaration must be placed at the top of every XHTML document, above all code and identities.

More details to visit the website

  • 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.