How to lower navbar buttons?

Hi,

I’ve been working on my navbar, and I’m trying to lower the buttons on the far right because it’s stuck to the top. I tried using line-height to move it down, but it just makes the button taller. Any advice on how to fix it?

Any help is very much appreciated!

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<section class="navigation">
  <div class="nav-container">
    <div class="brand">
      <img src="photos/ae-header-logo.png" alt="" srcset="">
    </div>
    <nav>
      <div class="nav-mobile"><a id="nav-toggle" href="#!"><span></span></a></div>
      <ul class="nav-list">
        <li>
          <a href="#!">Home</a>
        </li>
        <li>
          <a href="#!">About</a>
        </li>
        <li>
          <a href="#!">Services</a>
          <ul class="nav-dropdown">
            <li>
              <a href="#!">Web Design</a>
            </li>
            <li>
              <a href="#!">Web Development</a>
            </li>
            <li>
              <a href="#!">Graphic Design</a>
            </li>
          </ul>
        </li>
        <li>
          <a href="#!">Pricing</a>
        </li>
        <li>
          <a href="#!">Portfolio</a>
          <ul class="nav-dropdown">
            <li>
              <a href="#!">Web Design</a>
            </li>
            <li>
              <a href="#!">Web Development</a>
            </li>
            <li>
              <a href="#!">Graphic Design</a>
            </li>
          </ul>
        </li>
        <li>
          <a href="#!">Contact</a>
        </li>
      </ul>
    </nav>
  </div>
</section>
.navigation {
  height: 120px;
  background-color: rgb(225, 226, 225);
  
  
}
.brand {
  position: absolute;
  top: 1%;
  left: 0%;
  float: left;
  text-transform: uppercase;
  font-size: 1.9em;
  

}
.brand img{
  position: relative;
  margin-top: 0%;
  width: 500px;
  padding-left: 0%;
  
  left: 0%;
  float: left;
  

}
.brand img:hover{
  box-shadow: 10px;
  transition: all ease-in-out 0.5s;
  
  
}
.brand a, .brand a:visited {
  color: #fff;
  text-decoration: none;
  



}


.nav-list li:hover ul{
  display: block
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  background-color: red;
}
nav {
  float: right;
  position: relative;
  left: 20%;
  margin-top: 20px;
  background-color: rgb(255, 0, 212);

  
}
nav ul {
  list-style: none;
  
  margin: 0;
  padding: 0;
}
nav ul li {
  float: left;
  position: relative;
  
}
nav ul li a, nav ul li a:visited {
  display: block;
  padding: 0 20px;
  color: black;
  text-decoration: none;
}
nav ul li a:hover, nav ul li a:visited:hover {
  border-bottom: black 2px solid;
}
nav ul li a:not(:only-child):after, nav ul li a:visited:not(:only-child):after {
  padding-left: 4px;
  content: ' ▾';
}
nav ul li ul li {
  min-width: 190px;
}
nav ul li ul li a {
  padding: 15px;
  line-height: 20px;
}
.nav-dropdown {
  position: absolute;
  display: none;
  z-index: 1;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}
/* Mobile navigation */
.nav-mobile {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  background: #262626;
  height: 70px;
  width: 70px;
}
@media only screen and (max-width: 798px) {
  .nav-mobile {
      display: block;
 }
  nav {
      width: 100%;
      padding: 70px 0 15px;
 }
  nav ul {
      display: none;
 }
  nav ul li {
      float: none;
 }
  nav ul li a {
      padding: 15px;
      line-height: 20px;
 }
  nav ul li ul li a {
      padding-left: 30px;
 }
  .nav-dropdown {
      position: static;
 }
}
@media screen and (min-width: 799px) {
  .nav-list {
      display: block !important;
 }
}
#nav-toggle {
  position: absolute;
  left: 18px;
  top: 22px;
  cursor: pointer;
  padding: 10px 35px 16px 0px;
}
#nav-toggle span, #nav-toggle span:before, #nav-toggle span:after {
  cursor: pointer;
  border-radius: 1px;
  height: 5px;
  width: 35px;
  background: #fff;
  position: absolute;
  display: block;
  content: '';
  transition: all 300ms ease-in-out;
}
#nav-toggle span:before {
  top: -10px;
}
#nav-toggle span:after {
  bottom: -10px;
}
#nav-toggle.active span {
  background-color: transparent;
}
#nav-toggle.active span:before, #nav-toggle.active span:after {
  top: 0;
}
#nav-toggle.active span:before {
  transform: rotate(45deg);
}
#nav-toggle.active span:after {
  transform: rotate(-45deg);
}

In your padding you specify padding: 15px; for equal padding all around.
I would examine using specific paddings top, bottom, left, right instead.
If that doesn’t do what you are looking for, I would examine using display: flex as well.
Hope this helps some.

2 Likes

Thank you, that was exactly what I was looking for! :slight_smile: