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