CSS“不重复”不在IE中工作

时间:2012-04-09 19:54:39

标签: css internet-explorer content-management-system

在CMS中使用一些内联CSS(好玩!)。这段代码在Chrome和Firefox中应运行,背景图像只出现一次。但是当页面在IE 9中加载时,就好像忽略了无重复值,并且背景图像通过div的长度重复。

<div style="width: 500px; margin-top: -10px; background-image: url(http://.../uploadedImages/horizontal-rule-top.gif); background-position: 50% 0%; background-repeat: no-repeat, no-repeat; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(228, 128, 28); padding-top: 30px; padding-bottom: 15px; font-size: 16px; ">
...</div>

任何建议都会受到赞赏!

4 个答案:

答案 0 :(得分:5)

我认为IE在存在第二个no-repeat时遇到了问题,并且,根据规范,无视它不理解的规则。 IE理解的选项似乎是:

  • repeat-x
  • repeat-y
  • no-repeat

如果您将CSS修改为上述之一,它应该有效。

答案 1 :(得分:0)

在没有第二个值的情况下尝试background-repeat: no-repeat;。我相信这两个值语法是CSS3 working draft的一部分,可能不会由IE9实现。

答案 2 :(得分:0)

尝试你的背景css“background:url(http://.../uploadedImages/horizo​​ntal-rule-top.gif)no-repeat 50%0%;”

答案 3 :(得分:0)

Prova con:

background-repeat-x:no-repeat; background-repeat:repeat-y;