2

Final HTML output that I have a problem with:

Final HTML output

.navbar {
  font-family: Cookie, cursive;
  font-size: 40px;
  text-align: center;
  display: block;
}

a:link {
  text-decoration: none;
}

.navbar li {
  display: inline-block;
  padding: 10px;
}

.navbar .cur {
  color: black;
}
<nav>
  <ul class="navbar">
    <li><a href=index.html>Home</a></li>
    <li><a href=photo.html>Photography</a></li>
    <li><a href=blog.html>Blog</a></li>
    <li><a href=work.html>Work With Me</a></li>
    <li><a class="cur" href=about.html>About</a></li>
    <li><img class="log" src="assets/link_logo.png" alt="logo" height="40px"></li>
  </ul>
</nav>

Any suggestions to make the logo appear on the same baseline will be much appreciated.

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
Monish B
  • 51
  • 7

2 Answers2

1

Make the .navbar a flex container with no-wrap attribute set. This way all the items will be on the same line. If you want to vertically position them in the center - set the align-items: center attr on the flex container

E_net4
  • 27,810
  • 13
  • 101
  • 139
user0101
  • 1,277
  • 1
  • 9
  • 17
  • By the way, though it solved the problem of aligning the icon. I wanted the whole list to be In the center but after changing it to flex it got aligned to the left! Any ideas on how to change that? – Monish B May 27 '20 at 08:20
  • Use 'justify-content: center'. Have a read about flexbox feature – user0101 May 27 '20 at 08:20
  • 1
    Thanks again! Yeah I'm just starting. Will surely have a look! – Monish B May 27 '20 at 08:25
1

I think this code can help you!

.navbar {
  font-family: Cookie, cursive;
  font-size: 20px;
  text-align: center;
  display: block;
}

a:link {
  text-decoration: none;
}

.navbar li {
  display: inline-block;
  padding: 10px;
}

.navbar .cur {
  color: black;
}

.mainDiv{
  display: flex;
}
<div class='mainDiv'>
<div class='menuDiv'>
<nav>
  <ul class="navbar">
    <li><a href=index.html>Home</a></li>
    <li><a href=photo.html>Photography</a></li>
    <li><a href=blog.html>Blog</a></li>
    <li><a href=work.html>Work With Me</a></li>
    <li><a class="cur" href=about.html>About</a></li>
  </ul>
</nav>
</div>
<div class='logoDiv'>
  <span> <img src="https://cdn4.iconfinder.com/data/icons/social-media-icons-the-circle-set/48/linkedin_circle-512.png" width="100px" height="100px"></span>
</div>
<div>
Dupinder Singh
  • 7,175
  • 6
  • 37
  • 61