背景尺寸的替代:在IE7 +中覆盖 [英] Alternative for background-size:cover in IE7+

查看:127
本文介绍了背景尺寸的替代:在IE7 +中覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页的正文有一个背景图片。我已经使用 background-size:cover ,以便图像在身体上延伸,同时保持图像的高宽比。我想这对于IE7 + IE8是一样的。

I have a background image on the body of my web page. I have used background-size:cover so that the image stretches across the body whilst maintaining the aspect ratio of the image. I would like this to be the same for IE7 + IE8.

我已经看过下面的代码:

I have looked around and seen the following code:

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
    src='AutumnWinter_4.jpg',
    sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(
    src='AutumnWinter_4.jpg',
    sizingMethod='scale')";

但这不会保留长宽比,这对我们的目标网站。

But this doesn't preserve the aspect ratio, which is really bad for the website we are aiming at.

有什么办法吗?没有打开jQuery?

Is there any way to do this? Without hitting up jQuery?

推荐答案

backgroundSize.js实际上不会拉伸IE7中的bg图像,原始大小。查看他们的 演示 ,然后点击 '检查IE6-7-8用户通常看到的内容。

backgroundSize.js will not actually stretch the bg image in IE7, it seems to just center it at the original size. See their demo and click on 'Check what IE6-7-8 users would normally see.'

@danRhul

我读过 backstretch 将在IE7 +中工作

I have read that backstretch will work in IE7+

祝你好运!

这篇关于背景尺寸的替代:在IE7 +中覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆