仅 Safari 和 Opera 识别的 Hack;仅 Firefox 3 和 IE7 识别的 Hack。 1、仅 Safari 和 Opera 识别的 Hack
@media all and (min-width: 0px)
{/* Safari and Opera rules here */}
或者
@media screen and (-webkit-min-device-pixel-ratio:0)
{/* Safari and Opera rules here */}
注:这里所指代的 Safari 和 Opera 一般为最新版本。 2、仅 Firefox 3 和 IE7 识别的 Hack
selector, x:-moz-any-link, x:default
{/* Firefox 3 and IE7 rules here */}
使用方法例:
在
@media screen and (-webkit-min-device-pixel-ratio:0)
{
.box{width:100px;}
/* Safari and Opera rules here */
}
@media all and (min-width: 0px)
{/* Safari and Opera rules here */}
或者
@media screen and (-webkit-min-device-pixel-ratio:0)
{/* Safari and Opera rules here */}
注:这里所指代的 Safari 和 Opera 一般为最新版本。 2、仅 Firefox 3 和 IE7 识别的 Hack
selector, x:-moz-any-link, x:default
{/* Firefox 3 and IE7 rules here */}
使用方法例:
在
@media screen and (-webkit-min-device-pixel-ratio:0)
{
.box{width:100px;}
/* Safari and Opera rules here */
}

本文介绍了两种特定浏览器的CSS Hack技巧:一种适用于Safari和Opera浏览器,通过@media查询实现;另一种适用于Firefox3和IE7,利用特殊的选择器实现。这些技巧有助于开发者针对不同浏览器定制样式。
1497

被折叠的 条评论
为什么被折叠?



