css - 使用背景大小调整背景图像的大小,在 Firefox 中失败

标签 css firefox

我的链接前有一个图标,我将此图像设置为我的 a-tags 的背景:

a {
    background: url('../../images-1/pil.png') left center no-repeat;
    background-size: 8px auto; // This is the real width of the image
}

在某些地方我想要更小的图标,并且我想使用以下方法调整背景图片的大小:

a.small {
    background-size: 5px auto;
}

在 Firefox(和 IE9)中,这会导致图像被裁剪,即使它变小了。在 Chrome 和 Safari 中,它按预期工作。这是 Firefox 中的错误吗?我该如何解决这个问题? FF版本为28.0。

example picture

最佳答案

我认为你应该使用它来提高兼容性

a.small {
    background-size         : 5px auto;
    -webkit-background-size : 5px auto;
    -moz-background-size    : 5px auto;
    -o-background-size      : 5px auto;
}

关于css - 使用背景大小调整背景图像的大小,在 Firefox 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23242010/

相关文章:

iphone - 内容宽度未填满手机屏幕

javascript - 悬停时更改 webkit-scrollbar 宽度时重绘问题

.net - ASP.NET MVC 应用程序仅在 Firefox 中查看时才会出现内部服务器错误

javascript - innerHTML 不适用于 getElementsByClassName

javascript - 通过启用特定选项卡直接加载网页

html - 左侧菜单的问题

html - IE 显示问题 : Fieldset size not being determined by content, 和内联显示会导致其他问题

javascript - 在 Firefox 中的定位

javascript - 取消FF中的javascript onclick事件

javascript - 在 FireFox 中修改 WebRTC 的 SDP 约束