Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flexbox align-items: center

So basically my problem is that whenever I want to use align-items: center with an h1 and a nav-bar, it doesn’t work. I mean, it centers both but not quite right. This is the part of the code I’m interested in:

<header class="main-header">

  <h1>The Code Magazine</h1>

  <nav>
    <a href="blog.html">Blog</a>
    <a href="#">Challenges</a>
    <a href="#">Flexbox</a>
    <a href="#">CSS Grid</a>
  </nav>
</header>

The css should work when I just select the container for both the h1 and the nav, and set it to flex like this:

.main-header { display: flex; align-items: center; }

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

but when I do that this is the result:
This is how it looks

And this is how it’s supossed to look:

This is the result I want

Hope someone could help me out here, I’m quite new in CSS. Thanks.

>Solution :

You compare between lower case and upper case, try this https://codesandbox.io/s/dazzling-cache-dds7id?file=/index.html:246-281

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading