html - css 背景 url 在 express 中不起作用

标签 html css

我无法在 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/

相关文章:

javascript - 使用 Post 或 iframe 时,Internet Explorer 文件传输接收到的行重复

html - 用背景图像覆盖正文

php - 为什么添加css代码后模态窗口会隐藏? ( Bootstrap )

html - slider (范围)应该触发哪个事件才能正常工作?

javascript - 使用 JQuery OnClick 创建多个 HTML 元素

html - 无法删除导航栏下方的空间

html - 在https://modernizr.com/download上找不到Modernizr.load()或HTML5音频

javascript - 如何获得菜单的 Tololtip Tail

css - 只有部分元素受半透明覆盖影响

css - 搜索工具栏隐藏效果