Could someone help me with adjusting the title to better represent this question?
Is there a way to determine the width/height of a background-image and assign it directly to the width/height property in CSS without using JavaScript?
To clarify, here's an example:
element {
background: url(image.png);
width: auto;
height: auto;
}
I am aware that the above example does not work as intended, but I'm curious if there is a workaround for achieving similar functionality.
Thank you!
P.S: I can handle it with JavaScript, so no need to provide a JS solution.