IE兼容问题,各类css hack代码(亲测有效)_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:24:42
Original
955 people have browsed it

现在大部分企业对浏览器兼容要求是IE7+或者IE8+,要求IE6的很少,此处一并写出。

IE6:

_margin-top: 20px;
Copy after login

IE6+IE7:

*margin-top: 20px;<br />
Copy after login
+margin-top: 20px;
Copy after login

IE6+:

margin-top: 20px\9;
Copy after login

IE8+:

margin-top: 20px\0;
Copy after login

IE9:

/*:root在谷歌浏览器中也能被识别,所以需要加\9*/:root .item{    margin-top: 20px\9;}
Copy after login

IE8:

/*没有针对IE8的hack代码,但是可以组合实现*/margin-top:10px\0;:root .item{    margin-top: 20px\9;}
Copy after login

 

这只是头疼医头,脚痛医脚。可以解决生产中遇到的IE兼容问题,却不清楚究竟是哪些属性导致的兼容问题,有必要对浏览器解析CSS属性做一些了解,生产中尽量避开这些坑,提高开发效率。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!