You should use non-relative URLs in your CSS where possible. For example, if your public directory has this structure:
public
----css
--------cms
------------master.css
----js
----img
--------cms
------------bg_dark.jpg
Your CSS should look like this:
background-image: url("/img/cms/bg_dark.jpg")
I have:
public
---css
------cms
---------main.css
---images
------cms
---------bg_dark.jpg
But I have to prefix with the ../../ or it won't work.
Your code is correct, the image is relative to the stylesheet, so you need to go up 2 direcotries then down into images/cms/
You could also make it relative to the site root as thepsion5 suggests (begin with a "/")
elite123 said:
Your code is correct, the image is relative to the stylesheet, so you need to go up 2 direcotries then down into images/cms/
You could also make it relative to the site root as thepsion5 suggests (begin with a "/")
As I just said his suggestion doesn't work. The image isn't being loaded.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community