Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

css

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.

like image 522
Jitendra Vyas Avatar asked Sep 13 '11 09:09

Jitendra Vyas


People also ask

How is header different from the one which we make using div and advantages?

The benefit is that the mark-up describes the content and the structure of the document more accurately. A <div> with an id does not mean a header, whatever that id may be - it's completely arbitrary. Whereas a <header> is a header, no matter what its id .

What is difference between header and div?

For example, an article that is a part of the page. We could have a <div> for an article within a page, and a <header> tag as the first element within the <div> defining the header for that article.

When should header be used?

Headings are signposts that guide readers through an article. Therefore, they should indicate what a section or a paragraph is about. Otherwise, people won't know what to expect. Readers like to scan content, to get an idea of what the text is about and to decide which sections of the text they're going to read.

Does the header tag do anything?

Header tags, also known as heading tags, are used to separate headings and subheadings on a webpage. They rank in order of importance, from H1 to H6, with H1s usually being the title. Header tags improve the readability and SEO of a webpage.


2 Answers

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.

like image 119
Aly Avatar answered Nov 11 '22 17:11

Aly


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.

like image 45
Jon Avatar answered Nov 11 '22 19:11

Jon