HTML5 Semantics and Good Coding Practices
aniketpant.com
aniketpant.com
A good example would be the <meter> element which the spec specifically states:
The meter element also does not represent a scalar value of arbitrary range — for example, it would be wrong to use this to report a weight, or height, unless there is a known maximum value.
http://dev.w3.org/html5/spec/Overview.html#the-meter-element
This code is certainly not "bad code":
<section>
My height is 5 feet and 10 inches.
</section>
That's perfectly acceptable.I think marking up your height and weight and calling it better is dubious. Some would argue that the meter element itself is a bit dubious. I'm still not sure how I feel about it. A lot of the html5 elements are quite nice but you shouldn't go changing everything over just because it's new.
Yes there are better ways to use <meter>. Maybe for showing the average rainfall in an area!
And the reason for dismissing the techniques in the past is because I have shifted to using HTML5. Even the theme I am using for my website, uses HTML5.
However, when I read it I get the feeling that you don't understand that html5 was the standardization of community-grown ad-hoc patterns. The <div id="footer"> pattern isn't evil, it actually inspired <footer>. It's the original! The standardization of bottom-up practices rather than a spec coming down from the mountain on stone tablets is what makes html5 unique.
Anyway, my point is that from my point of view, this is a bit too good-vs-evil. But, what do I know? ;-)
I agree to your points. I guess that my post was a little ambiguous and a little biased.
I liked the old way of coding, but HTML5 brought order.
And for the part where the id's have helped in giving rise to header, footer, nav and article. Yes, I do agree to all of it.
Thank you for your comments. Helped my understand my writing.
Using these small terminologies will help us create a semantic web and help in understanding things better.
The main advantage is to make it easier to extract using an xml-like api. But at what cost? "5gm" is way easier for people to type so it will always dominate in real text.
In my mind, markup is useful for adding context that is hard to extract from the text alone: things like groupings, context, delimitating chapters or articles, etc… I wouldn't use it to declare something to be a weight. You use it to add things that are unspoken otherwise. In the <meter> example, it actually lets you convey previously unknown things such as the min/max range.
Maybe if the whole world cared a lot about the differences between different kinds of weights and it was very hard to get from the context of the text, like <catweight> vs. <dogweight> or something, it would be worth marking up. Markup is a form of metadata.
What excites me about "HTML5" (and I don't care what the official definition is) are extended capabilities of JavaScript like GeoLocation, Local Storage, Web Sockets and so on.
And as for the part where we "might" break the page in old browsers. I would like to pose a questions.
"Aren't we all working towards a developed future?"
However, I agree with your point(s).
the google bot, and many other crawlers, parsers etc. already make use of them.
My personal favourite semantic additions are:
1. The itemtype, itemscope and itemprop attributes, for completely unrestricted noun-based semantic markup (especially useful when using a standardized set of information schemas, such as those provided by http://schema.org/),
2. The <time> element, to allow easy parsing of time no matter how it is visually displayed, and
3. The <figure> element, which encapsulated pieces of media with their captions, much like a LaTeX figure does.
<figure> is a great addition for sure. Helps in improvising a lot of previous codes!