CSS:无法获取background-size:包含在Firefox 5中工作 [英] CSS: Can't get background-size: contain to work in Firefox 5
问题描述
根据 Mozilla开发人员网络,Firefox 3.6以来一直支持background-size ,但是,它显然不能在我的OS X版本 Firefox 5 中工作。在Safari中看起来不错,但 Firefox 5 无法正确显示。是否有错误?为什么我无法在Firefox中使用此功能?
According to Mozilla Developer Network background-size has been supported since Firefox 3.6, however, it is clearly not working in my OS X version of Firefox 5. It looks fine in Safari, but Firefox 5 is not displaying it correctly. Is there a bug? Why can't I get this to work in Firefox?
HTML:
<span class="special button">My button</span>
CSS:
.button {
background-size: contain;
}
.button.special {
background: url("/images/special-button-bg.png");
}
这是一个jsfiddle ,显示它不能正常工作。
Here is a jsfiddle which shows that it is not working correctly.
推荐答案
我不知道发生了什么,但它的工作原理,如果你有:
I'm not sure what's going on, but it works if you have:
.button.special {
background: url("/images/special-button-bg.png");
background-size: contain;
}
我的猜想是背景
属性覆盖 background-size
属性。但是,这并不能解释为什么Firefox的行为与Safari不一样。
My guess is that the background
property is overriding the background-size
property. However, that doesn't explain why Firefox is not behaving the same as Safari.
这篇关于CSS:无法获取background-size:包含在Firefox 5中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!