1

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)?

1
  • Can you show us the code you have linking to this?
    – camdixon
    Commented Nov 7, 2016 at 14:13

1 Answer 1

2

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().

1
  • Your answer was totally right. I initially did just this but accidentally had ../image/my-image.png instead of /images/ Commented Nov 9, 2016 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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