我无法在 express 中为部分标签创建背景图像。我尝试了几种不同的路径,包括:
#image{
background: url('/images/beachPierPanorama.jpg') 50% 0 no-repeat fixed;
}
#image{
background: url('./images/beachPierPanorama.jpg') 50% 0 no-repeat fixed;
}
#image{
background: url('../images/beachPierPanorama.jpg') 50% 0 no-repeat fixed;
}
这是我的文件目录的图片。您在上面看到的 css 位于 style.css 中,我正在尝试引用图像文件夹中的图像:
![IMG]http://i58.tinypic.com/dcbrkx.png[/IMG]
最佳答案
根据图片,/images
目录在 /public
中,所以
background: url('../public/images/beachPierPanorama.jpg')....
应该总是有效。
关于html - css 背景 url 在 express 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26579422/