Html5 follows six design principles.

Source: Internet
Author: User

Html5 follows six design principles.

In fact, html5 is not directly developed by w3c. w3c is directed to xhtml2 rather than html5. The w3c Working Group switched its research direction to html5. Why is xhtml2 never implemented? Because it violates a design principle, this design principle is the famous bertal law-to be conservative when sending; To be open when receiving. In the html5 design process, a series of principles are followed to facilitate the rapid promotion of html5. This article will introduce the six design principles followed by html5, as shown below:

Principle 1: Avoid unnecessary complexity

Html4

<! DOCTYPE html PUBLIC "-// W3C/dtd html 4.01 // EN" "http://www.w3.org/TR/html4/strict.dtd">

Html5

<! DOCTYPE html>
 
Html4

<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">

Html5

<Meta charset = "UTF-8">
 
Principle 2: support existing content

In the following four sections of code, only the first section of xhtml is correct. In html5, all sections are correct.

Copy XML/HTML Code to clipboard
  1. <P class = "foo"> Hello world </p>
  2. <P class = "foo"> Hello world
  3. <P class = "foo"> Hello world </P>
  4. <P class = foo> Hello world </p>

Principle 3: solving practical problems

In html4, even if two block-level element elements have the same link address, they must be written separately, because inline elements cannot contain block-level elements.

<H2> <a href = "/path/to/resource"> Headline text </a> <P> <a href = "/path/to/resource"> Paragraph text. </a> </p>

In html5, because the content model is used, <a> elements can also contain block-level elements.

Copy XML/HTML Code to clipboard
  1. <A href = "/path/to/resource">
  2. <H2> Headline text
  3. <P> Paragraph text. </p>
  4. </A>

 
Principle 4: Seeking Truth and being pragmatic

Html5 adds multiple elements, including section, article, aside, and nav. They represent a new content model-partition content. In the past, people used div to organize content on pages, but like other similar elements, div itself has no semantics. But section, article, aside, and nav are actually telling you clearly-this is like another document in the document. Any content in these elements can have its own summary, title, and foot.

Principle 5: stable degradation
 
When the browser encounters a type value that is not recognized, it will interpret the value of type as text

Input type = "number"
Input type = "search"
Input type = "range"
Input type = "email"
Input type = "date"
Input type = "url"

Principle 6: end users are given priority

In the event of a conflict, end users are given priority, followed by authors, followed by implementers, followed by standard makers, and finally theoretically completed.

The above are the six design principles that html5 should follow and hope to help you learn them.

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.