aspect-ratio working cases

Hey, I was messing around with something earlier and noticed that if an image for example had a max-width on it, aspect-ratio doesn’t work, but if it has a width, it does, could anyone explain why this happens? Thanks in advance
2 Replies
Senra
Senra9mo ago
It does becuase image is of a default size. That size may be bigger than the size you want it to be. So when you set the aspect-ratio It only sets the dimensions ratio. It does not change the default width of the image. Hence you set either the desired width or height to make it work
snxxwyy
snxxwyy9mo ago
ah i see, thank you.