11

Is there any practical benefit of using <header> over <div id="header">?

and writing css for header {} over #header {}

I know one downside is , I will have to punish IE users with a Javascript if use <header> otherwise it will not take style.

I know it's HTML5 but is there any advantage of using it until non HTML5 supported browsers are still in use.

IE6, IE7, IE8 and some old mobile browsers do not understand these new tags.

Edit:

It's OK to use a JS Canvas library to do something awesome in all browsers but to use a Javascript just to use some tags in IE wil decrease performance without a big reason.

4
  • 1
    See stackoverflow.com/questions/186264/… - it's an old post but has good points that are still valid. Commented Sep 13, 2011 at 9:56
  • header can be used multiple times. To do the same with a div you should use class="" instead of id="". Commented Sep 13, 2011 at 12:59
  • Using the new semantic tags will make you feel warm and fuzzy all over. Go ahead; give it a try! Commented Sep 14, 2011 at 13:48
  • @james.garriss - That is right but in IE we will have to add a javascript and even in many mobile browsers too Commented Sep 14, 2011 at 13:57

4 Answers 4

4

Besides the fact that it gives more meaning to the markup , when working with css you can more easily select the required items without resorting to id's or class.That reduces the amount of markup you are required to write , it makes mantaining the site alot easier and help other developers understand your code better if needed.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't think it reduce a good amount of bytes in markup. it's almost same.
1

I don't know for a fact, but I think it almost certain that using semantically better markup (e.g. <header>) will help search engine crawlers construct a better image of your website.

There is probably no other practical benefit of going HTML5, and even the above is not exactly tangible. So in practice I don't really believe you can argue that going HTML 5 (and doing the extra work needed to make your page compatible with earlier IE versions) is going to be a good investment.

On the other hand, if you don't care about obsolete browsers then there's really no drawback.

Comments

0

Well, from my point of view, it gives further meaning to the markup. At least in a more structured way. Say, for instance that you have to parse automatically your page (if it wasn't yours), you would know that the header will always be a and it doesn't depend on the CSS class used.

2 Comments

But I think we don't have any problem to using a class or id for header div. IE is already slowest in Javascript rendering and adding a javascript file just because we want to use a new HTML5 tag is not right, I think
It's not just because we want to use a new tag. If you look at other new tags that come in HTML5 you'll see that it tries to convey more meaning in the markup (article, section,...). You just have to weight the benefits versus the downsides...
0

Gives better structure to your page as Carles points out - this is especially helpful when it comes to search engines - they'll be able to crawl all your website a lot more effectively. You can use javascript to get IE to recognise HTML5 elements (simply put it inside an if statement).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.