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

Why isn't there space between my menu items?

I’m making a test site to get better at html and CSS. I found a design and started to try to make that design right now I have this:

site right now

But as you can see the navbar items are way too close to each other and for some reason the icon wont show up.

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

can someone explain to me why the navbar items wont get space between each other and why my icon is not showing up? Thanks in advance.

nav {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
}

nav .logo {
  font-size: 2.5rem;
}

nav ul {
  display: flex;
  list-style-type: none;
  padding: 0;
}

nav li a {
  color: white;
  padding: 1rem 2rem;
  text-decoration: none;
}
<nav class='container'>
  <div class='logo'><i class="fa-solid fa-otter"></i>Sea otters</div>
  
  <ul>
    <li a href='#'>Home</li>
    <li a href='#'>Species</li>
    <li a href='#'>Habitat</li>
    <li a href='#'>Behavior</li>
    <li a href='#' class='highlight'>Ecology</li>
  </ul>
</nav>

>Solution :

You’ve merged your list item and anchor element markup. They’re separate elements and need separate tags.

<li><a href='#'>Home</a></li>
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