如何在 style 标签内引用 rails erb 文件中的图像?
<div class="item" style="background-image: url(images/slider/bg2.jpg)">
当不使用 rails 时,以上 url 将在 html 版本中工作。
最佳答案
这应该可行
<div class="item" style="background-image: url(<%= asset_path('bg2.jpg') %>)">
关于html - 从 style 标签引用 rails 中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35814246/