老浏览器(特别是IE)支持html5标签

来源:互联网 发布:原生ajax请求json数据 编辑:程序博客网 时间:2024/06/05 05:37

主要有三个方法:


1、 javascript: document.createElenment("......")

<!--[if lt ie 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> 

不要忘了指定新建标签的display属性,大多情况下我希望标签是block的:

header,footer,article,aside,section,nav,menu,hgroup,details,dialog,figure,figcaption{display:block}

2、IE条件注释

<!--[if lt IE 9]><div class="section"><![endif]--><!--[if IE 9]><section class="section"><![endif]--><!--[if !IE]><!--><section class="section"><!--<![endif]-->    ......<!--[if lt IE 9]></div><![endif]--><!--[if IE 9]></section><![endif]--><!--[if !IE]><!--></section><!--<![endif]-->

IE特有的注释判断:

lte:就是Less than or equal to的简写,也就是小于或等于的意思。

lt :就是Less than的简写,也就是小于的意思。

gte:就是Greater than or equal to的简写,也就是大于或等于的意思。

gt :就是Greater than的简写,也就是大于的意思。

! : 就是不等于的意思,跟javascript里的不等于判断符相同


3、嵌套标签的方法

是在在语义化的html5标签内嵌套div等可用标签,然后只给div写样式,个人觉得意义不大!

4、使用xmlns定义文档的命我空间

不太熟悉,就不介绍了,其实有前两种方法就绝对够用了!

0 0
原创粉丝点击