Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Is it possible to set the background image inside .CSS file as we normally do we plain HTML?

Solved by Karmalakas View solution

Started by payman 6 years ago · 1 replies · 1119 views
6 years ago

I am migrating my website (written with HTML, CSS, and JS) into a GRAV project. I have a long set of media rules inside my CSS files for my background images. But when I run the project, the Images are not read. It seems they are being ignored.

CSS
    @media (min-width: 3200px) and (-webkit-min-device-pixel-ratio: 2),
  (min-width: 3200px) and (min-resolution: 2dppx) {
  [data-visible='true'] .image-2sy_q {
    background-image: url('../images/image_1a9jevki6koxp9.jpg');
  }
}
@media (min-width: 3840px) {
  [data-visible='true'] .image-2sy_q {
    background-image: url('../images/image_1a9jevki6koxp9.jpg');
  }
}
@media (min-width: 3840px) and (-webkit-min-device-pixel-ratio: 2),
  (min-width: 3840px) and (min-resolution: 2dppx) {
  [data-visible='true'] .image-2sy_q {
    background-image: url('../images/image_1a9jevki6koxp9.jpg');
  }

Is there a way to fix this?

thanks

6 years ago Solution

Don't have ATM how to test, but I guess paths are incorrect. Try changing to /user/themes/myTheme/images/image_1a9jevki6koxp9.jpg or similar, depending on where your images are at

👍 1

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 24 hours ago
2 40 17 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago