Displaying a row of logos can be tricky due to their varying shapes and sizes. In my latest post, I share how I approach building the perfect logo strip by adjusting logo heights based on aspect ratios.

https://9elements.com/blog/building-the-perfect-logo-strip/

Building the Perfect Logo Strip - 9elements

We've all been there: you're working on a website and need to display a row of logos—clients, partners, sponsors—you name it. However, logos come in all shapes and sizes, and making them look good together can be quite challenging. How do you get...

9elements
Here's a little preview of the final result.

@nilsbinder I don't like magic numbers, so I wondered: what if we'd just scale things based on the difference between the area of a square icon of a desired height, and the image's dimensions?

https://codepen.io/kizu/pen/qBeBJvX?editors=0100

This way, the final area of every logo is the same. Things are smaller in general, and some logos could benefit from bumping them up to align their size optically, but not sure if that_ could be done automatically, at least with just CSS :)

Logo Strip | fork

...

@kizu Wow, love the idea. I will definitely have another look at this. In this example, all logos apart from the owl have the same height (48px). I think it gets a lot more difficult when this is not the case (which I guess happens a lot in real life).
@nilsbinder Updated with a 200x500 image — it should still work fine with that algorithm, as it would still scale proportionally.

@kizu Yes, you're absolutely right.

I would like to make one final adjustment. I will reintroduce a "magic number," but this time it is called ---strength, and you can adjust the effect to your liking. When set to 1, you get the result you had in your pen; when set to 0, all icons have the same height. This way, I think it becomes a more flexible component rather than relying on a fixed magic number:

https://codepen.io/enbee81/pen/gOVOZyR

Logo Strip | refork

...

@kizu I hope I'll have some time tomorrow so I can include this in the original post!
@kizu I’ve just updated the original post to include the solution you provided, along with an explanation of how it works.