我有 CSS 文件
public/stylesheets/landing.css
使用标签时效果很好
<%= stylesheet_link_tag "/stylesheets/landing" %>
我也有这张图
public/images/1-hero-image.jpg
现在,在 css 文件中,我试图引用这个图像。
我尝试了以下变体:
background: url('1-hero-image.jpg');
background: url('/public/images/1-hero-image.jpg');
background: url('/images/1-hero-image.jpg');
background: url('images/1-hero-image.jpg');
它们似乎都不起作用。
如果您能提供任何帮助,我将不胜感激。