针对不同IE浏览器——HTML写法
一、HTML写法
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>无标题文档</title> </head> <body> <!--[if IE]> 这是IE <![endif]--> <!--[if lt IE 10]> 小于ie10的浏览器,不包括10 <![endif]--> <!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]--> <!--[if IE 9]> 只有ie9识别 <![endif]--> </body> </html>
二、css写法
hack
读法:黑客
支持程度:IE11及以后不支持
推荐使用:不建议
各版本写法:
\9 ——IE10之前的IE浏览器解析
+,* ——IE7及IE7之前的IE浏览器解析
_——IE6包括IE6之前的IE浏览器
@media screen and (-webkit-min-device-pixel-ratio:0){css代码}—— 谷歌浏览器下才显示的css
.box{ width:100px;height:100px;background:Red;background:blue\9; +background:yellow;_background:green;} @media screen and (-webkit-min-device-pixel-ratio:0){.box{background:pink}}