您的位置:首页 > Web前端 > CSS

css hack 大全

2015-09-01 14:03 573 查看
各个浏览器的css hack区别属性:

IE6:       _zoom:1;

IE6/7:     *zoom:1;

IE6/7/8/9 :\9

各个浏览器的css hack区别规则

IE6:   *html{}

IE7:   +.class{}

非IE6: html>body {}

仅火狐:@-moz-document url-prefix(){}

saf3+和谷歌:@media all and (-webkit-min-device-pixel-ratio:0){}

仅opera:@media all and (-webkit-min-device-pixel-ratio:10000),not all and(-webkit-min-device-pixel-ratio:0){}

iphone/mobile/webkit:@media screen and (max-device-width:480px){}




但是,我们应该尽量避免使用CSS Hack。

property:value; /* 所有浏览器 */

+property:value; /* IE7 */

_property:value; /* IE6 */

*property:value; /* IE6/7 */

property:value\9; /* IE6/7/8/9,即所有IE浏览器 */

* html selector { … }; /* IE6 */

*:first-child+html selector { … }; /* IE7 */

html>body selector { … }; /* 非IE6 */

@-moz-document url-prefix() { … }; /* firefox */

@media all and (-webkit-min-device-pixel-ratio:0) { … }; /* saf3+/chrome1+ */

@media all and (-webkit-min-device-pixel-ratio:10000),not all and (-webkit-min-device-pixel-ratio:0) { … }; /* opera */

@media screen and (max-device-width: 480px) { … }; /* iPhone/mobile webkit */
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: