The innovation of HTML 5: The Beauty of architecture

Source: Internet
Author: User
Tags new set

What is HTML 5, I don't need to repeat it here. For the innovation of HTML 5, according to my understanding, can be summed up as a semantic explicit labeling system, simplified rich media support, the magic of local data storage technology, do not need plug-in animation (canvas), strong API support. In short, HTML 5 lets human-computer interaction, human network interaction become more comfortable, fit the user. Previous support for rich media applications and this storage is no longer a pain in the browser. The purpose of the HTML 5 revolution is to push the web from a content platform to a standardized application platform and unified the standards of each platform camp.
In this article, I'm going to explain one of the innovations in HTML 5: A more explicit and concise structure.
From the "head".
A standard XHTML header code should look like this:

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

In addition, HTML 5, although not currently supported by all browsers, but this can save more than 100 bytes (for the day PV millions above the site, can save a lot of traffic oh) The head has been perfectly compatible. If you study the browser parsing mode, you should know that the page will trigger the quirks mode without defining the DOCTYPE, and you can parse the page in standard mode as long as the browser is defined, without having to specify a type of DTD.
A new semantic labeling system
Semantic coding is an essential skill for a qualified front-end developer, but with the increasing richness of web pages, it is clearly not enough to use the original XHTML tags to semantically. God says, "Be light!" Then there was light. As a result, HTML 5 provides a new set of tags and corresponding properties to reflect the typical semantics of modern web sites. Practice the truth. Let's write an example:

  1. <div id= "Header" >
  2. <div class= "Hgroup" >
  3. </div>
  4. <div id= "NAV" >
  5. <ul>
  6. <li>html 5</li>
  7. <li>CSS</li>
  8. <li>JavaScript</li>
  9. </ul>
  10. </div>
  11. </div>
  12. <!–//header end–>
  13. <div id= "Left" >
  14. <div class= "article" >
  15. <p> This is an article about the new structure tag for HTML 5. </p>
  16. </div>
  17. <div class= "article" >
  18. <p> This is also an article about the new structure tag for HTML 5. </p>
  19. </div>
  20. </div>
  21. <!–//left end–>
  22. <div id= "Aside" >
  23. <!–//side end–> <div id= "Footer" > The bottom of the page </div>
  24. <!–//footer end–>
Copy Code


above is a simple part of the blog page HTML, composed of the head, the article display area, the right column, the bottom. The coding is neat, and also conforms to the semantics of XHTML, even in HTML 5 can be very good performance. But for a browser, this is a code that does not have a separate weight, rather than a tag that allows the machine to read semantics and define the corresponding chunks. For example, a standard browser (such as Firefox, Chrome, or even a new version of IE9) has a shortcut that can direct the customer to the navigation of the page, but the problem is that all chunks are defined with a div, and the id value of the div is set by the developer, so The browser does not know which block the navigation link should be. The appearance of the new HTML 5 tag just makes up for this shortcoming. So, the above code, in HTML 5, can be written like this:

    1. <nav> <ul>
    2. <li>html 5</li>
    3. <li>CSS</li>
    4. <li>JavaScript</li>
    5. </ul> </nav>
    6. <div id= "Left" >
    7. <article> <p> This is an article about the new structure tag for HTML 5. </p> </article>
    8. <article> <p> This is also an article about the new structure tag for HTML 5. </p> </article>
    9. </div>
    10. <aside>
    11. <footer> bottom of the page </footer>
Copy Code


Originally, the HTML page structure can be so beautiful, without comments can be at a glance. For browsers, finding the corresponding chunks is no longer a loss.

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.