
HTML5 Semantics and Good Coding Practices - aniketpant
http://www.aniketpant.com/article/html5-semantics-and-good-coding-practices
======
po
First of all, it's nice to see people getting excited about html5 and to see
it being adopted widely... This article however, seems a little bit _too_
excited about jumping into html5 and a little too quick to dismiss the
techniques about the past. In the process it makes a few mistakes.

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.

~~~
davedx
I don't think the _intent_ of marking up things like height and weight is
dubious - isn't that the whole point of the semantic web? That you use
semantic markup to explicitly define your information content?

~~~
icebraining
Yeah, but maybe one should use a proper RDFa attribute, like dbpedia-
owl:Person/height and dbpedia-owl:Person/weight. HTML5 elements simply aren't
detailed enough.

~~~
aniketpant
I'm really sorry, but I am not aware of RDFa attributes?

~~~
icebraining
It's in the RDFa Primer [1]; I mean specifically the @property, @about and
@typeof attributes, which are used to augment existing HTML elements with RDF
semantics.

------
Tichy
I still don't understand why anybody would use those fancy new elements
instead of divs. The only thing "gained" would be breaking the page in older
browsers.

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.

~~~
nikcub
the reason for the new elements isn't to benefit users reading the page, it is
to benefit programs reading the page.

the google bot, and many other crawlers, parsers etc. already make use of
them.

------
geoffhill
These are very welcome improvements, especially in the area of adding a
parsable semantic structure to pages.

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.

~~~
aniketpant
I did forget to include <time> Will write on it in my next post.

<figure> is a great addition for sure. Helps in improvising a lot of previous
codes!

