日期:2014-05-17  浏览次数:20583 次

html网页中DOCTYPE疑问
<!DOCTYPE html>

<!--[if lt IE 7 ]> <html lang="en" class="ie6 ielt8"> <![endif]-->

<!--[if IE 7 ]> <html lang="en" class="ie7 ielt8"> <![endif]-->

<!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]-->

<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->

见有的html网页开头是这样写的,这样写具体作用是什么?麻烦大侠说下

------解决方案--------------------
你是问的第一个doctype吗??这个事HTML5的标准 简化了以前那个什么过渡型啊 什么的,估计20年的老程序员也背不下来 这个 写法看一遍就背下来了。注意是HTML5的标准哦 所以IE8以前都不支持的 哈哈。后面几个是heck,针对不同的浏览器版本 写不同的样式。 你的明白??不明白伐站内信
------解决方案--------------------
判断Ie 版本
------解决方案--------------------
doctype
参考下
http://www.w3school.com.cn/tags/tag_doctype.asp
http://www.w3school.com.cn/html5/tag_doctype.asp


<!--[if lt IE 7 ]>
这种写法只有ie能识别,注意是判断ie的版本,然后做相应操作,比如加载css 写脚本之类的。