我想结合使用 backround-repeat
round
和 repeat-x
。在许多不同的网页上,我看到 background-repeat: round
等于 background-repeat: round round
这意味着 Round times repeat to X and round times repeat to是的,不是吗?这就是为什么我认为编写 round no-repeat
只会向一个方向重复。
我的代码向所有方向重复。我正在使用 Firefox 30.0
。
<!DOCTYPE html>
<html>
<body style="background-image: url('bg.png'); background-repeat: round no-repeat">
</body>
</html>
它是特定于浏览器的,还是如果有办法我应该采取其他方式?
最佳答案
是的,它应该像您想象的那样工作。
问题是 Firefox 还不支持值 round
。然后,该规则将被忽略,使用的值是默认的 repeat
。
您可以在 MDN article 中查看浏览器支持:
- Chrome:没有
- Firefox:没有(bug 548372)
- 即:9
- 歌剧:10.5
- Safari:没有
作为解决方法,我建议使用后备值:
background-repeat: repeat no-repeat; /* fallback for old browsers */
background-repeat: round no-repeat; /* for browsers that support it */
关于html - CSS 背景仅在 Firefox 中向一个方向重复一轮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24643891/