Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center align logo image in header #816

Merged
merged 2 commits into from
Sep 14, 2024

Conversation

bamadesigner
Copy link
Contributor

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
Copy link
Owner

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

@bamadesigner
Copy link
Contributor Author

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
Copy link
Owner

Thank you @bamadesigner for the contribution 🙏🏼

@felixmosh felixmosh merged commit f5e1589 into felixmosh:master Sep 14, 2024
3 checks passed
@bamadesigner
Copy link
Contributor Author

Thank you @felixmosh !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants