html5有哪些新特性?如何处理html5新标签的浏览器兼容问题?如何区分html和html5?

h5新特性:
  语义化标签:<hrader></header> 、<footer></footer>、<nav></nav>、<section></section>、<article></article>、<aside></aside>、<video></video>、<audio></audio>
  新增表单元素:email、month、number、range、search、tel、url、week、time、date、datatime、datetime-local
  新增表单属性:placeholder、required、autofocus、autocomplete、maxlength、novalidate、max、min、step、multipe、disabled、checked
  新增的视频和音频标签:<video></video>、<audio></audio>
  canvas绘图
  SVG绘图
  拖拽
  WebWorker、WebStorage、WebSocket


h5新标签的兼容问题:
  (1)IE8/IE7/IE6支持通过 document.createElement

  (2)将html5shiv.js引入到head中(IE9及以下)
    <!--[if lt IE9]><script src="dist/html5shiv.js"></script><![endif]-->

    载入后,初始化新标签的CSS:

    /*html5*/ article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}

 

如何区分html和html5:
  (1)在文档类型声明上,h5为<!DOCTYPE html>,之前版本比较长
  (2)h5有语义化标签,如<header></header>

猜你喜欢

转载自www.cnblogs.com/wuqilang/p/11366962.html