Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to put an image as a bg CSS SASS

I’ve been learning some SASS from Traversy Media’s course, and after a few months off coding have been getting stuck with this: I’m trying to put the showcase.png as my .landing’s background through a url, but I can’t seem to get the right path.

This is a screenshot witht the file explorer on the left

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Given the directory structure:

/
├── css/
│   └── style.css
└── dist/
    ├── img
    │   └── showcase.jpg
    └── css
        └── style.scss

The image path has to be relative to the built CSS file, not to the uncompiled SCSS file: so it should be ../dist/img/showcase.jpg.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading