And in answering questions from users, I've seen a lot of websites with HTML5 markup. In this article, I'll show you some of the markup errors and bad practices that I've come across a lot and explain how to avoid them.
Don't use the tag as a wrapper for decoration
One of the most common problems I've noticed is the banal substitution My super duper page
This is just wrong:
With all that said, it would be nice to mark up the example above using HTML5 like this:
My super duper page
If you are not sure which element to use, then I advise you to use our element selection flowchart ( approx. translator: see at the very bottom of the entry).
Use and only when needed
There's no point in writing code if it's not necessary, right? Alas, I often see how - Element
represents a group of introductory or navigation aids and usually contains a section heading - Element groups a set of elements
-
, representing the section heading in case it consists of several levels (subheadings, alternative headings, etc.)
Excess elements
I'm sure you know perfectly well that the element My best blog post
If your
My best blog post
Misuse
And again about headers: I often see incorrect use of the element . Should not be used together with- There is only one header
- good on its own (i.e., without
).
My best blog post
by Rich Clark
In this case, just remove the hgroup. by Rich Clark
My best blog post
The second case is another example of using an element unnecessarily.
My company
Established 1893
If the only child
My company
Established 1893