日期:2014-05-16  浏览次数:20548 次

firefox 专属css hack

之前只有ie6、ie6、firefox时,只要写!important就能够零丁给firefox做hack了,可是此刻多了ie八、opera、 chrome等这些个所说的规范浏览器后,firefox能熟悉的工具它们都熟悉,偏生firefox有个致命的bug就是不撑持input的line- height属性,于是我又犯合计了,怎么办怎么办怎么怎么办呢?

网上搜刮一大圈,终于发明1个好措施,那就是@-moz-document url-prefix(){这搭是放css语句的处所},恁地庞大的一句话,只有firefox熟悉,如许就能够给firefox配置至有关line-height的padding了。

举个例子,本来1个按键的css是如许

.defaultmallsearchbt{width:70px;height:22px;line-h eight:22px;padding-left:16px;color:#fff;border:none ;background:url(../images/defaultmallsearchbt.gif) no-repeat;cursor:pointer;}

可是在firefox下书契在按键上是没有铅直居中的,以是要加之如许一句:

@-moz-document url-prefix(){.defaultmallsearchbt{padding:0 0 4px 16px;}}

疑难题目目解释题决,万事大吉!?

.input2{width:30px;height:21px;padding-top:4px;border:1px solid #d5d5d5;position:relative;*top:4px;}
@-moz-document url-prefix(){.input2{top:2px;}}