Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've found a website that uses divs with classes that are names of new HTML5 elements. At first it looked really ugly and silly, but then I gave it a secound thought and after all it's kind of smart and doesn't require older browsers to download html5shiv.js (which is IMHO quite important as IE6-IE8 machines are often older/slower pcs on slow networks).

For example:

Supports all browsers:

<div class="section">
   some content
</div>

Doesn't support IE6, IE7, IE8:

<section>
   some content
</section>

I've checked Twitter and Facebook and they're doing similar thing too, do you think it's worth sticking to the first (div) style of coding and wait IE8 to drop way below 1% or I'm overreacting and a few kilobytes won't change that much?

share|improve this question

2 Answers 2

I would say no, it's not bad practice. It's worth thinking about and talking about, but don't let it slow you down. On the other hand, I would say that supporting IE6, IE7, IE8 is bad practice.

You're entering holy-war territory here. I'm sure there will be conflicting opinions.

It's certainly valid HTML. An argument could be made that if you want to support browsers that don't support HTML5, you might not want to use HTML5.

There shouldn't be any accessibility issues with using DIVs instead of HTML5 elements.

Considering semantic markup, I would tend to think that you could find more meaningful names for your elements than the generic equivalents like 'section', but that depends on the content.

I doubt there would be any significant impact on performance.

Since it's someone else's code, I'd say that they've already made that decision. It's not wrong to use the theme and it's not likely that this would cause any difficulties.

share|improve this answer

When these new elements were first introduced, it was uncertain whether they would make it into the final spec. Many sites, in anticipation of this, wrote divs with a class name as you show, with the intention that, later, they could search and replace these with the elements of section, nav, etc. This may be true of the sites you have looked at. There is nothing wrong with that.

As far as waiting for IE8 to drop out, there are already javascript "shims" available to make those versions of IE behave correctly and have been around for years. Use them.

But waiting till IE8 drops below 1% would be a long wait and, if you're not using them on new pages now, you're already behind.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.