我设法用css放置了一个背景图片-only -它覆盖了整个页面,如果你放大或缩小,它会覆盖整个屏幕。我从html+css编码开始,但最终得到了这个更简单的解决方案。
问题是,它只能在Chrome上运行,当使用Firefox或IE操作时,图片甚至都不会出现。
这是我的css:
body {
background-image: url(/img/18A_0159.JPG);
background-size: cover;
}我尝试了不同的解决方案,比如直接把它放在css的html部分,但仍然只适用于Chrome,也查看了不同的论坛,但可能太旧了,没有更新?
我是个编程新手,所以欢迎任何帮助!也许更好的html+css??
发布于 2017-05-27 21:38:43
您的url需要用引号括起来。
body {
background-image: url("/img/18A_0159.JPG");
background-size: cover;
}发布于 2017-05-27 22:15:55
尝尝这个
body{margin: auto;
padding: 0px;
background: url(images/bg.jpg) no-repeat center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;}发布于 2017-05-27 22:09:53
body{
background: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQvRaBo6ZZdUBrwsgfzubKwSf-E6Bsqm1RkfmGh8X40uiSVV-fSNw);
background-size: cover;
}
注意:
https://stackoverflow.com/questions/44217512
复制相似问题