【发布时间】:2018-10-16 19:36:38
【问题描述】:
This 是我的图像所在的位置。
我已经尝试了图片上显示的几个选项,我的 html 上有我的 css(培训目的)C:\Users\developer\Desktop\HTML Folder2
【问题讨论】:
-
以正确的格式重新发布您的问题..
-
把你的代码放在这里。
标签: html image css background
This 是我的图像所在的位置。
我已经尝试了图片上显示的几个选项,我的 html 上有我的 css(培训目的)C:\Users\developer\Desktop\HTML Folder2
【问题讨论】:
标签: html image css background
以下内容取自https://css-tricks.com
感谢 CSS3 中的 background-size 属性,我们可以纯粹通过 CSS 来做到这一点。我们将使用 html 元素(比 body 更好,因为它总是至少是浏览器窗口的高度)。我们在其上设置了一个固定且居中的背景,然后使用设置为 cover 关键字的 background-size 调整其大小。
html {
background: url(http://enjoycss.com/webshots/hB_1.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
【讨论】:
body {
background: url(HTML Folder2/image.jpg)no-repeat;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}
【讨论】: