本文介绍了background-position-y 在 Firefox 中不起作用(通过 CSS)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,background-position-y 不起作用.在 Chrome 中没问题,但在 Firefox 中不起作用.

In my code the background-position-y doesn't work. In Chrome it's ok, but not working in Firefox.

大家有什么解决办法吗?

Anyone have any solution?

推荐答案

如果你的 position-x 是 0,那么除了写没有别的解决办法:

If your position-x is 0, there's no other solution than writing :

background-position: 0 100px;

background-position-x 是来自 IE 的非标准实现.Chrome 确实复制了它,但遗憾的是不是 firefox...

background-position-x is a non-standard implementation coming from IE. Chrome did copy it, but sadly not firefox...

但是,如果您在大背景上有单独的精灵,并且行和列表示不同的事物,则此解决方案可能并不完美......(例如,每行上的不同徽标,选择/悬停在右侧,左侧为普通)在这种情况下,我建议将大图分离成单独的图像,或者在 CSS 中编写不同的组合......根据精灵的数量,一个或另一个可能是最佳选择.

However this solution may not be perfect if you have separate sprites on a big background, with rows and cols meaning different things... (for example different logos on each row, selected/hovered on right, plain on left)In that case, I'd suggest to separate the big picture in separate images, or write the different combinations in the CSS... Depending on the number of sprites, one or the other could be the best choice.

这篇关于background-position-y 在 Firefox 中不起作用(通过 CSS)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 10:22