Is there a way to extract the src attribute value from an HTML file and store it in a variable in a css/scss file so I can easily use it in the url() property like this:
<style>
img[src]{
background-image:url(attr(src));
}
</style>
Instead of coding each individual image, I want to automatically grab their src value, insert it into the url property, and set it as the background image.
-
I've tried a few methods, such as using custom properties, but nothing seems to work. Is there a solution to achieve this or something similar?
Thank you