The situation:
My custom CSS files are located inside the web/css directory and the page is accessing these files just fine. I can see my styles in effect as they are being loaded.

The problem:
The only problem I am experiencing is that there are several div blocks that I have set a background image for and these images aren't showing up. I am almost certain this is due to the location structure.

How do I properly reference the images located in my web/images folder to my css file (located in web/css)?

  • Can you show us the code you have linking to this? – camdixon Nov 7 '16 at 14:13

The proper way to reference the images would be using Unix-style directory symbols: ../images/your-image.png. Ideally, you'd put styles like this in the HTML head or perhaps inline them. Either way, the ideal would be to output the path using $block->getViewFileUrl().

| improve this answer | |
  • Your answer was totally right. I initially did just this but accidentally had ../image/my-image.png instead of /images/ – Daniel Barenboim Nov 9 '16 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.