引用资产供应商目录中的图像URL

时间:2015-01-13 17:10:18

标签: css ruby-on-rails assets

当css文件位于background image url目录中时,如何引用vendor/assets/stylesheets?在查看SO帖子之后

background: url(myimage.png) repeat-x;

background: asset-url('myimage.png'image) repeat-x;

但他们都没有工作

3 个答案:

答案 0 :(得分:1)

你应该试试

background: url("/assets/ion/myimage.png") repeat-x;

答案 1 :(得分:0)

将图片放在app/vendor/assets/images/myimage.png

#research_sign {
background: url("myimage.png") repeat-x;
}

    #Important: don't forget to restart your server!
     (as you added image inside your vendor/images)

答案 2 :(得分:0)

尝试此文件路径

 background-image: url("../../assets/ion/myimage.png") repeat-x;