开发者

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

开发者 https://www.devze.com 2023-04-04 17:16 出处:网络
Is there any practical benefit of using <header> over <div id=\"header\">? and writing css for header {} over #header {}

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.


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.


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.


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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消