Question

I've been trying as hard as I can to use only semantic class names, but my recent foray into microdata and SEO has made me wonder: is there a point to doing both? Consider these two HTML snippets representing an event:

With CSS classes:

<div class="event" itemscope itemtype="http://schema.org/Event">
  <h3 itemprop="name">Spinal Tap</h3>
  <div  class="description" itemprop="description">One of the loudest bands ever
  reunites for an unforgettable two-day show.</div>
  Event date:
  <time itemprop="startDate" datetime="2011-05-08T19:30">May 8, 7:30pm</time>
</div>

Without CSS classes:

<div itemscope itemtype="http://schema.org/Event">
  <h3 itemprop="name">Spinal Tap</h3>
  <div itemprop="description">One of the loudest bands ever
  reunites for an unforgettable two-day show.</div>
  Event date:
  <time itemprop="startDate" datetime="2011-05-08T19:30">May 8, 7:30pm</time>
</div>

Both represent the same content, and both are easy to style. I could easily just use attribute selectors to apply styles to the one without any type of classes applied to it beyond possibly applying some sort of additional class (in this example, possibly something like "upcoming" or "past").

So with this in mind, is there still any advantage to using semantic classes when there's already so much free information already added by microdata? The only thing that comes to my mind is Javascript selector performance but I'm not entirely sure how big of a hit that might be.

No correct solution

OTHER TIPS

If I get purist, using classes is like saying "drive it if it's a car". Using microdata is like saying "drive it if it has a Volkswagen logo". Presumably you could have something without microdata that is a "description", and vice versa.

It might also be more consistent if you only use classes for styling a segment, rather than a mixture of classes and microdata.

In your particular example, it probably doesn't matter. In a node that is higher up the tree these distinctions would be more consequential.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top