Firefox/Opera 是否可以处理定位/多个背景图像?

发布于 2024-08-21 21:41:33 字数 477 浏览 2 评论 0原文

在 Firefox/Opera 中显示特定背景图像时遇到问题,所有其他浏览器都在玩球(显然 IE 除外,为此我不得不妥协)。

目前,Opera 不允许使用多个背景图像,如下所示:

background-image: url('/images/h2_default_bg.png'), url('/images/dashed_bg_default.gif');
background-repeat: no-repeat, repeat-x;
background-position: top left, bottom left;

另外,当背景图像以像素为单位定位时,Firefox 和 Opera 都显得很尴尬:

background: url('/assets/images/dashed_bg.gif') bottom 2px repeat-x;

对于这些问题是否有任何简单的解决方法?

Having issues getting specific background images to display in Firefox/Opera, all other browsers are playing ball (except obviously IE, for which I've had to compromise).

Currently, Opera won't allow multiple background images like so:

background-image: url('/images/h2_default_bg.png'), url('/images/dashed_bg_default.gif');
background-repeat: no-repeat, repeat-x;
background-position: top left, bottom left;

Also both Firefox and Opera are both being awkward when a background image is positioned in pixels:

background: url('/assets/images/dashed_bg.gif') bottom 2px repeat-x;

Are there any simple workarounds for either of these problems?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鸠书 2024-08-28 21:41:33

仅从 Firefox 3.6Opera 10.5。这些是您正在测试的版本吗? Chrome 和 Safari 已经支持它们,我想你的意思是“所有其他浏览器......显然除了 IE”

至于你的第二个问题, 规范对 background-position 语法进行了如下说明

如果给定两个值并且至少一个值不是关键字,则第一个值表示水平位置(或偏移量),第二个值表示垂直位置(或偏移量)。

所以你给它们的顺序是错误的。改为 2px 底部

Multiple backgrounds are only supported starting from Firefox 3.6 and Opera 10.5. Are those the versions you're testing in? Chrome and Safari already support them, which I presume you mean with "all other browsers ... except obviously IE"

As for your second problem, the spec says this about the background-position syntax:

If two values are given and at least one value is not a keyword, then the first value represents the horizontal position (or offset) and the second represents the vertical position (or offset).

So you've given them in the wrong order. Make it 2px bottom instead.

枯叶蝶 2024-08-28 21:41:33

目前,Opera 不允许使用多个背景图像,如下所示:

CSS2 / 2.1 中不可能有这样的多个背景图像,目前我们仍然 必须遵守

请参阅此目前浏览器支持多种背景的 quirksmode 页面

至于其他设置,背景位置肯定可以跨浏览器工作,我不知道那里有任何不兼容之处。 Firefox 和 Opera 中到底发生了什么?

Currently, Opera won't allow multiple background images like so:

Multiple background images like that are not possible in CSS2 / 2.1, which at the moment we still have to adhere to.

See this quirksmode page on which browsers currently support multiple backgrounds.

As for the other settings, background position definitely works across browsers, I'm not aware of any incompatibilies there. What exactly happens in Firefox and Opera?

┈┾☆殇 2024-08-28 21:41:33

正如您所发现的,多种背景适用于所有现代浏览器。从版本 10.5 开始,它可以在 Opera 中运行。没有关于 IE9 是否拥有它以及 IE 是否/何时支持它的信息。

As you found out, multiple backgrounds works in all the modern browsers. It does work in Opera as of version 10.5. There is no information on whether IE9 will have it nor if/when IE will ever support it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文