兼容

<!DOCTYPE html><!--[if lt IE 7 ]><html class="ie6"><![endif]--><!--[if IE 7 ]><html class="ie7"><![endif]--><!--[if IE 8 ]><html class="ie8"><![endif]--><!--[if IE 9 ]><html class="ie9"><![endif]--><!--[if (gt IE 9)|!(IE)]><!--><html><!--<![endif]--><!--STATUS OK-->

 

 

用HTML5的<DOCTYPE>标签兼容各版本IE浏览器的方法技术

 

<!DOCTYPE html>是HTML5中唯一的doctype,也被视作将网页“升级”到HTML5的第一步。

很多国外网站的<!DOCTYPE html>和<HEAD>之间都会有一段注释,如:

<!—[if IE 6 ]><html class=“ie ielt9 ielt8 ielt7 ie6” lang=“en-US”><![endif]—>
< !—[if IE 7 ]><html class=“ie ielt9 ielt8 ie7” lang=“en-US”><![endif]—>
< !—[if IE 8 ]><html class=“ie ielt9 ie8” lang=“en-US”><![endif]—>
< !—[if IE 9 ]><html class=“ie ie9” lang=“en-US”><![endif]—>
< !—[if (gt IE 9)|!(IE)]><!—><html lang=“en-US”><!—<![endif]—>

作用于css。来写一些针对IE各版本的样式差异

先判断用户用的哪个IE版本,然后在 标签上加上该版本的class,这样可以方便hack
css文件是这样写的。
.ie6 xxx {};
.ie7 xxx {};
这是目前最好的hack方式之一。

posted @ 2015-08-26 16:21  fleam  阅读(240)  评论(0编辑  收藏  举报