felixmosh / bull-board

🎯 Queue background jobs inspector
MIT License
2.36k stars 366 forks source link

Center align logo image in header #816

Closed bamadesigner closed 2 months ago

bamadesigner commented 2 months ago

Hi!

This is a minor tweak to the CSS for the header logo and image. It allows the image to be center-aligned vertically, and the image max height is set to the height of the container. This change allows users to set whatever height and width they want for the image, and it will auto-scale in the container.

Thanks!

felixmosh commented 2 months ago

Hi @bamadesigner thank you fo this PR. Can you share some images with the previous state and the new one?

bamadesigner commented 2 months ago

Of course!

Here is the previous state if I don't have a width or height set on the logo: Screenshot 2024-09-14 at 11 21 20 AM

Here is the previous state if I set a width and height on the logo: Screenshot 2024-09-14 at 11 23 56 AM

Here is the new state with the align-items: center set on the <a> element: Screenshot 2024-09-14 at 11 24 39 AM

You could only add the align-items: center to the <a> element and that would fix the main vertical align issue.

But as a helpful bonus, you can also add width: auto and max-height: 100% to the <img> element, and it makes a better layout for any images that are set to be bigger than the space.

When I first added my image, I set the width and height as 100px because I had not yet determined that the header container was hard-set to 80px tall: Screenshot 2024-09-14 at 11 35 13 AM

So adding the width: auto and max-height: 100% to the <img> element resolved that: Screenshot 2024-09-14 at 11 41 06 AM

But, really, I can live without the width: auto and max-height: 100% and just set 50px for the width and height of my image, as long as I have the align-items: center on the <a> element: Screenshot 2024-09-14 at 11 39 15 AM

felixmosh commented 2 months ago

Thank you @bamadesigner for the contribution 🙏🏼

bamadesigner commented 2 months ago

Thank you @felixmosh !