News for hackers. Stuff that matters.
Re:State of CSS by hot_gril on Sunday October 23, 2022 @06:38PM (#33310969)
I'll have to set up my sandbox in React again to find the exact problem, but I recall it being this way: I wanted an img to size like a normal div and display the image with the original aspect ratio, either zooming or adding blank area to fit, depending on the use case.

Naturally I tried making an outer flexbox'd div then putting a {width: 100%, height: 100%} img inside that with whatever fit option. And several variations on that, including the "width: auto" or "width: 0" tricks. Somehow it'd always either go outside the div boundaries or exhibit some other glitchy behavior. There are tons of SO questions from confused individuals in my same situation, all with different answers that only work in certain scenarios.

There are no comments on this comment yet.