我想知道如何让背景图片适应每个屏幕和浏览器,并且不会被裁剪。我发现大多数技术都会略微裁剪图片。 我知道有很多技术可以实现这一点,但我想知道你认为哪种最好。 谢谢!
我想知道如何让背景图片适应每个屏幕和浏览器,并且不会被裁剪。我发现大多数技术都会略微裁剪图片。 我知道有很多技术可以实现这一点,但我想知道你认为哪种最好。 谢谢!
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;
}
<img src="img/beach.jpg"
style="width:100%;height:100%;position:absolute;top:0;left:0;z-index:-5000;">
http://thewebthought.blogspot.com/2010/10/css-making-background-image-fit-any.htmlg