.test { margin-top: -69px; /*for chrome*/ margin-top: -64px\9; /*for ie*/ margin-top: -67px\9; /*请问ff safari 的应该怎么写呢*/ padding:8px; 如果margin 这个 用ff的hack 实现不了 那么就加在padding上 ff? padding:10px; /*请问ff safari 的应该怎么写呢*/ }
谢谢
回复讨论(解决方案) -webkit-margin-top试试
http://leeiio.me/css-hack-for-firefox-opera-safari-ie/
-webkit-margin-top试试
-webkit-margin-top:-67px;
不行啊
可以注意hack的书写顺序
#tip {
background: blue; /*firefox 背景变蓝色*/
background: red \9; /*ie8 背景变红色*/
*background: black; /*ie7 背景变黑色*/
_background: orange; /*ie6 背景变橘色*/
}
或者
firefox 的 css hack 写法
第一个使用了 body:empty 来区分 firefox 1 和 2 。第二个 hack使用了全部 firefox 浏览器的专有扩展 -moz。 -moz- 只对 firefox有效,使用这个 hack 大可不必担心其他浏览器的影响。
/* css document firefox 1、firefox 2 css hack */
body:empty .tl{ color:#f90;}
/* css document firefox css hack */
@-moz-document url-prefix(){
.tl{ color:#f90;}
}
opera 的 css hack 写法
/* css document opera css hack */
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0){
.tl{ color:#f90;}
}
chrome、safari 等 webkit内核浏览器 的 css hack 写法
/* css document chrome、safari css hack */
@media screen and (-webkit-min-device-pixel-ratio:0){
.tl{ color:#f90;}
}