I believe that the best methods for the new HTML5 building blocks are still being developed, and the forgiving nature of the new HTML5 economy means that you can establish the conventions that make the most sense for your application.
In my applications, I have separate markup considerations that reflect the layout of the view (i.e. a template that creates overall consistency from page to page) compared to the content itself (usually this is any function or query results that get additional markup before insertion into various areas of the layout). The difference is because the semantics of the layout element (for example, the header, footer, and to the side) do not actually help in delimiting the content during the search, since this markup usually repeats from page to page. I particularly welcome the use of semantic differences in HTML5 to describe the content that the user is actually looking for. For example, I usually use an article to wrap my main content and navigation to carry any linked list of links. Widget wrappers are usually tied to the page layout, so I would go with the template convention for this guide.
Whenever I have to choose semantic or common names, my general heuristic is this:
- If there is a possible use case in the page template, follow this use case;
- If the item in question is a new part of the page layout (compared to the content request that is displayed in the region in the layout) and there is no control template in the template, the div is great for matching this behavior of the page layout to;
- If the content is created dynamically (that is, everything that falls into the layout during the request - messages, navigation, most widgets), wrap it in a semantic shell that best describes what this element is (against what you think it is should appear)
- Whenever you create or create content, use HTML5 semantic markup according to that content (hgroup to copy hierarchical headings, section to arrange snippets within an article, etc.). This is a reliable enrichment for the search.
Accordingly, a div will be beautiful as a wrapper for your widget if your page template no longer sets another widget wrapper. In addition, using header elements to create a large, bold look in widgets uses markup for the look, not the semantics. Since your particular use is motivated in appearance, it would be better to use divs or spans with CSS classes that allow you to specify sizes, spacing and other decorations as needed for this non-specific text, rather than overriding the browser defaults for header elements. I would keep the title elements for the page title, widget titles and headings in the main content area of the page. There may be problems with SEO ranking for misuse of headings that are not part of the main content.
I hope these ideas help you consider using HTML5 markup.
source share