【发布时间】:2015-05-06 02:51:25
【问题描述】:
CSS 背景图片未显示。这是我用于标题部分的手写笔文件:
.header {
height 50vh
border-bottom 5px solid #34495E
background url(img/head.png) no-repeat center center fixed
background-size cover
}
.nav {
display flex
align-items center
justify-content flex-end
padding 1em
background rgba(0,0,0,0.5)
position fixed
top 0
left 0
width 100%
z-index 5
}
.nav-item {
list-style none
display inline
padding 1em
}
a {
text-decoration none
color #ececec
transition 1s
padding-right 1em
}
a:hover {
color darken(#ececec, 25%)
text-decoration underline
}
.space {
content " "
height 3.0625em
}
这是它的样子:
这是作为标题背景的图像(其中包含 Darcey Mckelvey 的白色部分):
【问题讨论】:
-
URL 工作正常,一切设置正确,我对此进行了测试。
-
您能提供一个jsfiddle.net 吗?
-
@DavidAnderton 我不能把它用玉石和手写笔写成,要花很多力气来转换。
-
img 文件夹是否与 css 文件位于同一位置,因为您拥有的路径是相对于 css 文件的位置的。通常的设置需要路径 ../img/head.png
-
好的达西谢谢你的回复