使网站背景图像适合屏幕大小 [英] Fit website background image to screen size
问题描述
我刚开始在一个网站上,我已经遇到了一个小问题,我找不到具体的解决方案.
I'm just starting on a website and I already encounter a small problem where I can't find a specific solution to.
我想让我的网站背景在宽度上适合任何屏幕尺寸,高度无关紧要.
I wanted to make my website background fit any screen size in width, height does not matter.
这是我图片的链接:
../IMAGES/background.jpg
编辑
我不知道出了什么问题,但由于某种原因,身体甚至不想获得背景图像.它只是显示纯白色背景.
I have no idea what's wrong, but for some reason the body doesn't even want to get the background image. It just displays a plain white background.
body
{background-image:url(../IMAGES/background.jpg);}
推荐答案
你可以用这个插件做到这一点 http://dev.andreaseberhard.de/jquery/superbgimage/
you can do this with this plugin http://dev.andreaseberhard.de/jquery/superbgimage/
或
background-image:url(../IMAGES/background.jpg);
background-repeat:no-repeat;
background-size:cover;
不需要浏览器的前缀.两个浏览器都已准备就绪
with no need the prefixes of browsers. it's all ready suporterd in both of browers
这篇关于使网站背景图像适合屏幕大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!