2011-01-05 148 views

回答

11

試試這個:

button::-moz-focus-inner { 
    border: 0; 
    padding: 0; 
} 

(記住,冒號()加倍,是的。)

在這種情況下,額外的填充是由一個模糊的Firefox錯誤引起的。

(自己遇到這個錯誤我已經通過Google搜索找到了解決方案at this blog)。

+2

COOL!我的英雄 !非常感謝 – dareal 2011-02-06 04:44:55

+0

這也消除了聚焦環,這可能最終導致你有可訪問性問題,順便說一句。 – 2013-05-08 19:05:04

0

好了,我不知道爲什麼會這樣,但這裏是一些陌生感。它也會影響Safari,並且略有不同。如果向按鈕跨度添加負邊距,它將在Firefox中移動一半距離,而不是在Safari中移動。所以,解決方案似乎抵消了背景圖像。這是破解它的一種方法:

/*grey button hacks non-IE*/ 
button.grey span{ 
    background-position: 0 -1px; 
} 
button.grey:hover span{ 
    background-position: 0 -36px;  
} 
button.grey:active span{ 
    background-position: 0 -71px;  
} 

/* IE workaround. The \9 makes non-IE ignore these styles*/ 
button.grey span{ 
    background-position: 0 0px\9; 
} 
button.grey:hover span{ 
    background-position: 0 -35px\9;  
} 
button.grey:active span{ 
    background-position: 0 -70px\9;  
} 

這裏舉例:http://jsbin.com/orami3/9