Avoid six common HTML5 errors

Source: Internet
Author: User

Click here for the original article by Richard Clark.

This article is an original translation and simplified the original text. This document follows the signature-Non-Commercial Use Agreement.

I. Do not use section as a substitute for div

One of the most common errors in tag use is to arbitrarily use HTML5 <section> as <div>-specifically, it is directly used as a substitute (for style ). In XHTML or HTML4, we often see the following code:

Now in HTML5, this will happen.:

This is incorrect:<Section> it is not a style container.. The section element represents the semantic part of the content used to help build the document summary. It should contain a header. If you want to find an element used as a page container (like HTML or XHTML style), write the style directly to the body element, as Kroc Camen said. If you still need additional style containers, continue using div.

Based on the above ideas, the following are examples of correct use of HTML5 and some ARIA roles features (note that you may also need to add div based on your own design)

If you still cannot determine which element to use, I suggest you refer to HTML5 sectioning content element flowchart

  • Four pages in total:
  • Previous Page
  • 1
  • 2
  • 3
  • 4
  • Next Page

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.