CSS 什么背景图像尺寸适合每个显示器上的页面尺寸?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8584921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What background image size will fit the page size on every monitor?
提问by Abriel
I'm going to try and create an image that will be the background for my website and scale to every monitor size.
我将尝试创建一个图像作为我网站的背景并缩放到每个显示器尺寸。
If there isn't a definite size, should I either:
如果没有确定的大小,我应该:
Just make it the biggest browser size out there and see if that
works?Create an image and have the background hidden so parts of it are only revealed when it gets to be its biggest?
只需将其设置为最大的浏览器大小,看看是否
可行?创建一个图像并隐藏背景,这样它的一部分只有在它变得最大时才会显示?
回答by Danferth
try reading here Perfect Full Page Background Image
尝试在这里阅读完美的整页背景图片
回答by Ayman Safadi
Check out these two articles:
看看这两篇文章:
- http://kimili.com/journal/flexible-scalable-background-image
- http://beingwicked.com/development/full-scalable-background-images/
- http://kimili.com/journal/flexible-scalable-background-image
- http://beingwicked.com/development/full-scalable-background-images/
They describe a new technique I've been seeing a lot lately that scales a background image to the user's screen.
他们描述了一种我最近经常看到的新技术,它可以将背景图像缩放到用户的屏幕上。
回答by Shaun
There is a very simple solution to this I found. using css3 I applied the following:
我找到了一个非常简单的解决方案。使用 css3 我应用了以下内容:
background-size: cover;