我怎么能伸展整个窗口的背景? [英] How can I stretch background on the whole window?

查看:117
本文介绍了我怎么能伸展整个窗口的背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图伸展背景,以填补与HTML / CSS整个窗口。结果
我已经看到了这几个解决方案,但他们不工作。结果
每一个解决方案,我遇到不会在所有浏览器,无论是Chrome将不能夸大,或IE浏览器不会拉伸它,如果他们都这样做时,Firefox会是问题之一。

I'm trying to stretch the background to fill the whole window with HTML/CSS.
I've seen a few solutions for this but they don't work.
Every solution i encounter won't work on all the browsers, either Chrome won't stretch it, or IE won't stretch it, and if they both do, firefox will be the problematic one.

有没有人有一个有效的解决方案,这将在所有的浏览器? (不介意一些JavaScript)

Does anyone have a working solution, that will work on all browsers ? (don't mind some javascript)

推荐答案

我相信是没有办法做到这一点,而无需创建一个img元素,其z顺序设置为底部,然后定制的的宽度。 此页面有更多的细节。

I believe there is no way to do this without creating an img element, and setting its z-order to the bottom and then customizing the width of that. This page has details.

编辑:在链接它说,使用的位置是:固定; 。这将仅在旧版本的IE工作,如果你指定的doctype。使用绝对是一个简单的解决方法,只要该元素是身体的直接子。

In the link it says to use position: fixed;. This will in only work in older versions of IE if you specify a doctype. Using absolute is a simple workaround as long as the element is a direct child of the body.

这篇关于我怎么能伸展整个窗口的背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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