在窗口的100%处的背景图像(并随之调整大小) [英] Background image at 100% of window (and resizes with it)

查看:120
本文介绍了在窗口的100%处的背景图像(并随之调整大小)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

​​拉伸和缩放CSS背景
如何拉伸背景图片覆盖整个HTML元素?
背景图像不能拉伸整个页面宽度

Stretch and Scale CSS Background
How do I stretch a background image to cover the entire HTML element?
background image doesn’t stretch full page width

我有一个网页背景图片,该图片需要以窗口大小的100%完整显示.如果调整窗口大小,则图像需要随之调整大小,以保持100%.

I've got a webpage background image, which needs to be displayed fully at 100% of the window's size. If the window is resized, the image needs to resize with it, to stay at 100%.

CSS不允许您设置背景图像的大小,而只能设置其重复方式. (但我想把它拉长)

CSS does not allow you to set the sizes of the background image, only the way it repeats. (but I want it stretched)

我认为jQuery是克服浏览器不兼容的最安全,最快的方法.还是可以使用常规javascript快速完成此操作?

I assume jQuery is the safest and quickest way of realizing this, to overcome browser-incompatibleness. Or can this be done quickly with regular javascript?

推荐答案

此链接可能会让您感兴趣:

This link might interest you:

如何在网页中拉伸背景图像

这篇关于在窗口的100%处的背景图像(并随之调整大小)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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