多个背景图像 IE8

发布于 2024-10-08 04:33:34 字数 47 浏览 0 评论 0原文

是否有任何 jquery 插件(或任何其他方式)强制 IE8 显示多个背景图像?

Is there any jquery plugin (or any other way) to force IE8 to show multiple background images?

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

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

发布评论

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

评论(3

木緿 2024-10-15 04:33:34

适用于 Internet Explorer 和旧版 Mozilla Firefox 的 CSS3 多个背景

该库通过从样式和链接标记读取 CSS 代码,为 Internet Explorer 6-8 和 Firefox <=3.5 提供对多个背景图像的支持。

CSS3 浏览器支持扩展到背景图像、背景位置、背景重复。该库仅实现了自己的速记样式背景属性。

http://plugins.jquery.com/project/multiple-bg< /strong>

在此处输入图像描述

示例用法

包括脚本

需要包含的只是 jQuery 库和此脚本才能使这些功能发挥作用。不需要额外的 JavaScript 编码。缩小后的库只有 8.7kB!

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.multiple-bgs.js"></script>

编写 CSS

使用该 Javascript 库读取使用背景属性的多个背景。请注意如何支持悬停和活动状态。

#ex1 {
    background: url(middle.gif) repeat-x 0 0; /* For unsupported browsers */
    background: url(left.gif) no-repeat 0 0, /* For CSS3 Browsers */
                url(right.gif) no-repeat 100% 0, 
                url(middle.gif) repeat-x 0 0;
}
#ex1:hover {
    background: url(middle-hover.gif) repeat-x 0 0; /* For unsupported browsers */
    background: url(left-hover.gif) no-repeat 0 0, /* For CSS3 Browsers */
                url(right-hover.gif) no-repeat 100% 0, 
                url(middle-hover.gif) repeat-x 0 0;
}
#ex1:active {
    background: url(middle-active.gif) repeat-x 0 0; /* For unsupported browsers */
    background: url(left-active.gif) no-repeat 0 0, /* For CSS3 Browsers */
                url(right-active.gif) no-repeat 100% 0, 
                url(middle-active.gif) repeat-x 0 0;
}

CSS3 Multiple Backgrounds for Internet Explorer and legacy Mozilla Firefox

This library brings support for multiple background images to Internet Explorer 6-8 and Firefox <=3.5 by reading the CSS code from style and link tags.

CSS3 browser support extends to background-image, background-position, background-repeat. This library only implements its own property for the shorthand style background property.

http://plugins.jquery.com/project/multiple-bg

enter image description here

Example Usage

Including the Script

All that needs to be included is the jQuery library and this script for these features to work. No extra Javascript coding is required. The minified library is only 8.7kB!

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.multiple-bgs.js"></script>

Writing the CSS

Multiple backgrounds using the background property are read using this Javascript library. Notice how hover and active states are supported.

#ex1 {
    background: url(middle.gif) repeat-x 0 0; /* For unsupported browsers */
    background: url(left.gif) no-repeat 0 0, /* For CSS3 Browsers */
                url(right.gif) no-repeat 100% 0, 
                url(middle.gif) repeat-x 0 0;
}
#ex1:hover {
    background: url(middle-hover.gif) repeat-x 0 0; /* For unsupported browsers */
    background: url(left-hover.gif) no-repeat 0 0, /* For CSS3 Browsers */
                url(right-hover.gif) no-repeat 100% 0, 
                url(middle-hover.gif) repeat-x 0 0;
}
#ex1:active {
    background: url(middle-active.gif) repeat-x 0 0; /* For unsupported browsers */
    background: url(left-active.gif) no-repeat 0 0, /* For CSS3 Browsers */
                url(right-active.gif) no-repeat 100% 0, 
                url(middle-active.gif) repeat-x 0 0;
}
小猫一只 2024-10-15 04:33:34

CSS3 PIE 可能会满足您的需求 CSS3 PIE

CSS3 PIE might do what your looking for CSS3 PIE

写下不归期 2024-10-15 04:33:34

如果背景图片不超过3张,你可以在css中使用:before:after。例如,请参阅此链接

如果您希望 ie7 也能正常工作,您可能需要在头部添加以下内容:

<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>

If it is not more than 3 images as background, you can play around the :before and :after in the css. See this link for example.

You may need to add the following in the head though if you want ie7 to behave as well:

<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文