css完善的全屏图象背景 [英] css perfect full screen image background
问题描述
我想知道哪些是适合每个屏幕,每个浏览器的背景图片的最佳解决方案。我也注意到,大多数技术裁剪图像一点点。
我知道有很多技术来做到这一点,但我想知道哪个是你最好的意见。
谢谢!
I'm wondering which is the best solution for an background image to fit every screen, every browser. Also I've noticed that the majority of techniques crop the image a little bit. I know there are a lot of techniques to do this but I want to know which is the best in your opinion. Thanks!
推荐答案
此 post from CSS-tricks.com 涵盖了全屏背景图像的不同技术,包括旧版本IE的回退(我没有测试IE修复)。
This post from CSS-tricks.com covers different techniques for full screen background images and includes a fall-back for old versions of IE (I haven't tested the IE fix).
当我不需要担心支持旧的浏览器时,我通常使用CSS3方法:
When I don't need to worry about supporting old browsers, I generally use the CSS3 method:
html {
background: url(http://lorempixum.com/1440/900/sports)
no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
这篇关于css完善的全屏图象背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!