简体   繁体   中英

Usage of HTML5 Tags

Questions

  1. On average, has the usage of HTML5 semantic tags increased compared to the usage of CSS layers ( div )?
  2. Also, is there a good difference between them and does it optimize the code for better speed and maintainability?
  3. Differences in character length is not much and <div id="footer"> is compatible in older browser without using Modernizr or other Javascript solutions to emulate support of HTML5 in non supported browsers. Therefore, if I only use semantic tags of HTML5, and not using any advance functionality of HTML5 like audio , video , etc. am I missing something?

Examples

HTML

<footer> and <div id="footer">

CSS

#footer {} and Footer {}

From what I've seen and experienced, HTML5 tags like and are mainly provided for SEO so that search engines can (one day?) possibly use those sections and other tags properly.

Like you said, most of the tags are semantic and provide no real functional benefit- in fact, most break rendering in older browsers. I ran into an issue with these new tags when I tried dynamically loading HTML5 content with jQuery and the HTML5Shiv.js/Modernizr.js. I was unable to properly render the elements that were dynamically loaded in older browsers such as IE8 and IE7.

At this point, I'd recommend sticking with divs, as they're more widely used and provide better cross-browser functionality.

My two cents.

On average, has the usage of HTML5 semantic tags increased compared to the usage of CSS layers (div)?

You are conflating two different ideas here. CSS can be applied to new elements just as easily as it can to old ones. The use of CSS is independent of use of semantics.

Also, is there a good difference between them and does it optimize the code for better speed and maintainability?

Speed? Certainly not.

Maintainability? Well, they reduce div soup, so in theory, yes.

The advantage comes from having more semantics in the document, so tools can extract relevant parts of documents, skip over sections, etc.

Differences in character length is not much and is compatible in older browser without using Modernizr or other Javascript solutions to emulate support of HTML5 in non supported browsers. Therefore, if I only use semantic tags of HTML5, and not using any advance functionality of HTML5 like audio, video, etc. am I missing something?

Err… you're missing audio and video. (Whether that matters for your site is another story)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM