Css background image not working

I’m trying to set the background of a page to an image I have in the
assets/images folder in my rails app.

However, for the life of me I cannot get it to work. When I open up and
inspect the element I keep seeing in the resources that the file cannot
found with a red “!” next to the image.

I have tried different paths still no avail…


In my static_pages.css.scss I have

body {
background: url(/images/bg.png);


Figured it out!

Simply added

background: url(bg.png);

If you prefer use scss with assets pipeline its better use following
background: image-url(bg.png);

More about it you can read in RG:

2.2.2 CSS and Sass