Just read the recent question here about not being able to import a variable into a CSS background-image url path and saw a couple of suggested inline workarounds. However, if I just want to use an image located in the public directory, is there a way to do that without even having to import anything?
For example, I have slide-1.webp currently located in both public/images as well as src/images of my folder structure. I just want to use it (from either location) as a background image for one of the divs on my index.astro page, similar to the following:
.container {
height: 90vh;
background-image: url('images/slide-1.webp');
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
padding: 100px 0;
}
However, no matter how I write the path, it doesn't work. Seems like this should be a simple concept to execute. What am I missing? Thanks!