html - CSS 背景仅在 Firefox 中向一个方向重复一轮

标签 html css firefox

我想结合使用 backround-repeat roundrepeat-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 */

Demo

关于html - CSS 背景仅在 Firefox 中向一个方向重复一轮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24643891/

相关文章:

css - OpenERP( View ) - 随着标签和字段之间的空间变化?

css - 如何为 Firefox/IE/Chrome 应用最大宽度样式

javascript - 使用输入过滤字段并在angularJS中下拉

php - 如果php mysql的记录有 'ñ',如何在html中输出?

javascript - Firefox 22 mozGetUserMedia 使用 'screen' 作为设备源

html - 将 child 定位在 parent 身上绝对没有高度

jquery - 如何构建具有多个图像切换的文档

javascript - css3-mediaqueries.js VS respond.js

google-chrome - anchor 内跨度内 anchor , Chrome

jquery - 如何捕获手指触摸屏幕以及手指从触摸屏设备上的屏幕移开的时间