About HTML 5

Source: Internet
Author: User

One, avoid unnecessary complexity.

For example, before we created an HTML page, we had to write it like

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

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

For HTML 5,<! DOCTYPE HTML> Such a format is OK.

The reason is that DOCTYPE is written to the authenticator. That is, the reason to write that line of XHTML 1.0 doctype at the beginning of the document is to tell the authenticator that the validator will follow that DOCTYPE to validate my document. But according to another design principle of HTML 5, it must be backwards compatible, compatible with future HTML versions-whether HTML6, HTML7, or whatever-with the current HTML version, HTML 5. Therefore, placing a version number in the DOCTYPE does not make much sense, even for the verification certificate.

There are also like <meta http-equiv="Content-type" content= " text/html; Charset=utf-8 " /> in HTML 5 can be written <Meta charset=" Utf-8 ">

Second, support the existing content

For example, in HTML5, the attribute value can be unquoted, but the quotation marks are also right. Here are some of the right things to do

  • <img src="foo" alt="bar" />
  • <p class="foo">hello world</P>
  • <img src="foo" alt="Bar">
  • <p class="foo">hello World
  • <IMG src="foo" alt="Bar">
  • <p class="foo">hello world</P>
  • <img src=foo alt=bar>
  • <p class=foo>hello World</P>

Third, solve the real problem

Another design principle for HTML 5 is to solve real-world problems. It is obvious that the format and specification for solving various problems are everywhere, so it seems to me that the principle is to solve the theoretical problems rather than solve the real problems. The principle of design is to recognize the universal problem theoretically and eliminate the sensitive problem.

For example: The page already has a piece of content, I want to add a link to the whole piece of content. This piece of content includes a title, a paragraph

Past practices:

  • <h2><< Span class= "Tag-name" >a href= "/path/to/resource" span class= "tag" >>headline text</a>< span class= "tag" ></h2> 
  • <p><a href="/path/to/resource">paragraph text. </a></P>

Right now:

    • <a href="/path/to/resource">
    • <h2>headline text</H2>
    • <p>paragraph text. </P>
    • </a>

Four, pragmatic

The meaning of pragmatism for HTML is: Before tackling the headaches, look at what people have come up with in response to these problems. It is imperative to concentrate on understanding these "folk" solutions.

The new semantic elements in HTML 5 are reflected in the principle of truth and pragmatism. The new elements are not too much, not infinitely scalable, but they are a good thing. Although the number is few, but the meaning is very unusual. These new elements involve head (header), foot (footer), partition (section), article (article) ..., and I'm sure you won't feel strange.

For example, the previous document:

  • <body>
  • <div id="header", .... </div>
  • <div id="Navigation"... </div>
  • <div id="main"; </div>
  • <div id="sidebar"... </div>
  • <div id="Footer"... </div>
  • </body>

Now it can be changed to:

  • <body>
  • <header, ..... </Header>
  • <nav... </nav>
  • <div id="main"; </div>
  • <aside... </aside>
  • <footer... </footer>
  • </body>

Five, smooth degradation

An example of how HTML 5 follows this principle is to use the Type property to enhance the form. The new values that can be specified for the type attribute are listed below, with number, search, range, and so on.

The most critical question is what the browser will do when it sees these new type values. Existing browsers are not future browsers, and existing browsers are unable to understand these new type values. However, when they see a type value that they do not understand, the value of type is interpreted as text.

Six, end-user first

This design principle is essentially a mechanism for conflict resolution.

Once a conflict is encountered, the end user first, followed by the author, followed by the implementation, followed by the standard-setting, and finally the theoretical perfection

Seven, designed for 80% only

This is a common design principle and is also a common pattern, namely Pareto principle

Pareto, an Italian economist, raised this ratio by 80/20, saying that 20% of the world's population has 80% of the wealth. This proportion also coincidence the phenomenon of power law distribution in various fields of nature. In short, whether you are writing software or creating something, the same is true, that 20% of the effort can reach 80% of use cases. The last 20% use cases require 80% or more of the effort. Therefore, sometimes it is reasonable to make the design for only 80%, because we know that only 20% of the effort is required.

Eight, first for human design, followed by machine design.

I hope these principles have inspired the design of our software.

About HTML 5

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.