Felix
Felix

Reputation: 5619

how to center wordpress navigation

What would be the best way to center the navigation on this wordpress page:

tried this:

@media (min-width: 768px) {
  .navbar-nav {
    float: none;
    padding: auto;
  }
  .nav {
    padding-left: 10%;
  }
}

from here: https://colorlib.com/wp/forums/topic/how-do-i-center-my-sites-navigation-bar/

but has absolute no affect

Thanks in advance.

Upvotes: 0

Views: 287

Answers (2)

Balwant
Balwant

Reputation: 755

Add this snippet in your style :

@media only screen and (min-width: 60.001em){
.main-navigation-menu>li {
    float: none;
    display: inline-block;
}

#menu-oberes-menue {
    text-align: center;
}
.main-navigation-menu ul li{
   text-align:left;
}
}

Upvotes: 1

Ravi Patel
Ravi Patel

Reputation: 5211

<div class="menu-wrap"> // need to add this div before ul

<ul id="menu-oberes-menue" class="main-navigation-menu">
      {your menu list}
</ul>

</div>

Add your css

.menu-wrap {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

enter image description here

Upvotes: 1

Related Questions