你能告诉我如何让背景图像适应显示器的大小吗? 这是我得到的:
body {
background: url(../images/bg.jpg) #eee fixed no-repeat center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font: 12px Tahoma, sans-serif;
即使我在一台显示器上有垂直滚动条而在另一台显示器上没有滚动条。
谢谢!
最佳答案
固定居中的背景
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
工作于:
Safari 3+
Chrome Whatever+
IE 9+
Opera 10+ (Opera 9.5 supported background-size but not the keywords)
Firefox 3.6+ (Firefox 4 supports non-vendor prefixed version)
关于css - 固定背景调整到显示器尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30753010/