Adding a background image in Ruby on Rails 2 in CSS

前端 未结 6 943
野趣味
野趣味 2020-12-07 19:08

I generated a scaffold in ruby and I want to insert a background image to every page on the site but Im not sure what the link to the image should be.

my image is

6条回答
  •  天命终不由人
    2020-12-07 19:44

    If your image is in app/assets/images/dep.jpg, then in the css file in rails you should write background: url('/assets/dep.jpg');

    You don't have to put the image in the public folder this way.

提交回复
热议问题