html {
background : url(../images/20141105_183642.jpg) left top no-repeat fixed;
background-size : cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
<style type="text/css">
body {
background:url (../images/20141105_183642.jpg) #000000 no-repeat left top;
background-size: 100%;
}
到目前为止,文本和链接都是正确的,所以我将只包含背景 CSS 部分。在我将我的 html 和 css 移动到有组织的文件夹之前(以上只是我大学作业的一部分,我在其中遇到了麻烦。)我能得到一些关于我哪里出错的启示吗?由于我的索引页面没有完全加载,我开始在这个页面上拉扯我的头发。非常感谢!
最佳答案
CSS 规则必须包含在 <style>
中标签(应该用 </style>
关闭)如果它们不在外部文件中..
<style type="text/css">
html {
background : url(../images/20141105_183642.jpg) left top no-repeat fixed;
background-size : cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body {
background:url (../images/20141105_183642.jpg) #000000 no-repeat left top;
background-size: 100%;
}
</style>
关于html - 我是编码新手,我不太确定为什么我的 index.html 无法正确加载。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27581177/