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
- <P class = "foo"> Hello world </p>
- <P class = "foo"> Hello world
- <P class = "foo"> Hello world </P>
- <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
- <A href = "/path/to/resource">
- <H2> Headline text
- <P> Paragraph text. </p>
- </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.