针对Firefox,Opera,Safari,GoogleChrome等浏览器的CSS hack
各种常见浏览器使用的内核(RenderingEngine)
1.MozillaFirefox(Gecko)
2.InternetExplorer(Trident)
3.Opera(Presto)
4.Konqueror(KHTML)
5.Safari(WebKit)
6.GoogleChrome(WebKit)
最近在调整 GoogleChrome 的兼容性,所以找了些资料,希望可以帮到朋友们。有什么问题也可以补充。
一、针对Chrome和Safari等Webkit核心浏览器的CSS hack代码:
@media screen and (-webkit-min-device-pixel-ratio:0) { /* Webkit内核兼容CSS */ }
示例: @media screen and (-webkit-min-device-pixel-ratio:0) { .font1 {color:#f00} .border1
{border:1px solid #f00;} .bg3 {background:#f00;} }
二、除此之外,还有专门针对某个浏览器的CSS hack方法,如针对Webkit核心浏览器和Opera的写法:
/*Webkit and Opera*/ @media all and (min-width:0px){ .font1 {color:red;} }
三、针对Opera浏览器的写法:
/*Opera*/ @media all and (-webkit-min-device-pixel-ratio:10000),not and all (-webkit-min-device-pixel-ratio:0) { .font1 {color:red;} }
四、针对Firefox浏览器的写法:
/*Firefox*/ @-moz-document url-prefix() { .font1 {color:red} }
除了添加CSS hack以外,还应该给每个CSS hack加上注释,这样才能便于自己以后查找。
原载: 大连网站制作 http://www.noonenet.cn/
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明。否则将追究法律责任。
Tags:
针对Firefox,Opera,Safari,GoogleChrome,CSS hack同类文章:
·
锚点链接同一页面和不同页面的某个位置,解决IE6不好用·
CSS兼容性,层透明·
如何设计注册表单,才能提升用户体验·
IE6、IE7、IE8、IE9、Firefox兼容性问题总结·
JS左侧列表点击标题伸缩的效果,IE6BUG