0

How can i center my logo (img) and menu links horizontal. I want the logo to be at the left and menu at right but horizontal centered. here's my code!

thanks

<div class="menu-container">
  <div class="logo">
    <a href="#"><img src=https://app.box.com/representation/file_version_186133299510/image_2048/1.png class="logo"></a>
  </div>
    <nav class="menu">
                <a href="#">Branding</a>
                                <a href="#">Logos</a>
                                <a href="#">Illustration</a>
                                <a href="#">Web</a>
                                <a href="#">Poster</a>
                                <a href="#">Letters</a>
                                <a href="#">All</a>
                                <a href="#">About</a>
     </nav>

</div>
<div class="main-intro">
       <h2>Let's create something great together!</h2>
    </div>

---CSS---

* {
  padding: 0px;
  margin: 0px;
}

.menu-container{
  background-color: gray;
  margin: 30px;
  position


}

.logo {
  height: 10em;
  display: inline-block;
  padding: 1em;
  transition: all 0.6s ease;
    -webkit-transition: all 0.6s ease;
}


.menu {
  float: right;
  margin: 2em; 2em; 0; 0;
  display: inline-block;
  vertical-align: center;
}

https://codepen.io/Randomood/pen/KmJpWX?editors=1100

3KP_W3
  • 43
  • 6

2 Answers2

0

try removing the height of your logo from you css?

.logo {
  display: inline-block;
  padding: 1em;
  transition: all 0.6s ease;
  -webkit-transition: all 0.6s ease;
}

EDITED:

* {
  padding: 0px;
  margin: 0px;
}

.menu-container{
  background-color: gray;
  margin: 30px;
  position: relative;
  padding: 1em;
}

.logo {
  height:10em;
  border: 1px solid red;
  display: inline-block;
  transition: all 0.6s ease;
    -webkit-transition: all 0.6s ease;
}

.menu {
  float: right;
  margin: 4.5em 0em;
  display: inline-block;
  vertical-align: center;
}
PenAndPapers
  • 2,018
  • 9
  • 31
  • 59
0

Just try doing this to your "menu-container"

.menu-container{
   display:flex;
   flex-direction:row;
   justify-content:center;
   background-color: gray;
   margin: 30px;
 }

Codepen

Sidharth Anil
  • 768
  • 1
  • 6
  • 14