我在 div 中使用图像作为背景,我想对 Firefox 和 Chrome 使用不同的定位。
我想将这个用于 Mozila:
background-position: left -14px bottom -1px !important;
我想将这个用于 Chrome:
background-position: left -14px bottom -2px !important;
这可能吗?请给我建议..
最佳答案
您可以为 FF 和 Chrome 使用特定的选择器:
以 Chrome 为目标:
@media screen and (-webkit-min-device-pixel-ratio:0) {
.yourElement {
background-position: left -14px bottom -2px !important;
}
}
以 FF 为目标:
@-moz-document url-prefix() {
.yourElement {
background-position: left -14px bottom -1px !important;
}
}
这比使用用户代理要好得多。
关于html - Firefox 和 Chrome 的不同背景位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20989891/