Article introduction of Wulin.com (www.vevb.com): Consistency requirements for HTML5 documents should be formulated, and even new elements, attributes, APIs and content models should be used. In this way, web content can be elegantly downgraded in older or less capable user agents. Let's use HTML5 form to illustrate. The new types added to input include number, search, range, email, date, url, etc. These new types values are in browsers that do not support it.
Note: The examples in this article should be shown in code, but because the DOCTYPE we are using now is XHTML1.0, the browser cannot read HTML5 code, and pre cannot be pre
Read the code, so it can only be explained in words.
Avoid unnecessary complexity
Concise solutions are always more popular than complex ones, if possible.
The document type of HTML 4.01 is set like this (I omitted angle brackets because of browser parsing):
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN
The DOCTYPE of XHTML 1.0 is:
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
In HTML 5, if unnecessary complexity is eliminated, doctype is simplified to:!DOCTYPE html
Support existing content
The existing content relies on the expected user agent processing and behavior to achieve the expected functionality.
Supporting existing content means 100% support for existing content.
Solve real problems
The problem faced by web page content is not suitable for the actual solution that cannot cater to existing needs.
For example, suppose I use HTML 4 or XHTML 1, corresponding to a whole piece of content, such as a product list, including product picture, product title, product introduction, etc. I want to add three identical links to these three elements respectively. However, in HTML5, you can use a tag to include these three blocks. That is, the a tag contains block-level elements. This solves the real problem.
Seeking truth and being pragmatic
The new semantic elements in HTML5 are reflections that follow the principle of truth-seeking and pragmatic.
If you look at the web page now, there will probably be some codes like this: id=header id=navigation id=main id=sidebar id=footer However, in HTML5, the newly added tags can replace the corresponding div, such as header, nav, aside, footer. Don't think these are replacements of id. No, the new tags are actually replacements of class, because these tags can be reused on the page.
Stable degradation
Consistency requirements for HTML5 documents should be formulated, and even new elements, attributes, APIs, and content models should be utilized. In this way, web content can be elegantly downgraded in older or less capable user agents.
Let's use HTML5 forms to illustrate. The new types added to input include number, search, range, email, date, url, etc. These new type values will be interpreted as text in browsers that do not support it. Therefore, you can boldly use HTML5 forms, which can be downgraded elegantly.
End user priority
Once conflict is encountered, the end user is preferred, followed by the author, the implementer, the standard setter, and finally the theoretical perfection.
PDF: design of html5