Get width and height of background-image?


I would like to get the width and height of a couple of background-images and compare the aspect ratio between them and add a class to the one width the least width compared to height. Is this possible? If so can anyone point me in the correct direction?

Would be easier with actual img’s, so if this is not possible, anyone know how I could center an absolute positioned image so that it works kind of like how background-size: cover; works?

There are other options that just cover, which might be what you want here.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.