Answers for "how to center topnav bar in html"

1

center nav bar css

div#nav{
  text-align: center;
}
div#nav ul{
  display: inline-block;
}
Posted by: Guest on March-18-2021
0

top centered nav html

.nav{
    border:1px solid #ccc;
    border-width:1px 0;
    list-style:none;
    margin:0;
    padding:0;
    text-align:center;
}
.nav li{
    display:inline;
}
.nav a{
    display:inline-block;
    padding:10px;
}

<ul class="nav">
  <li><a href="/">Home</a></li>
  <li><a href="/about/">About</a></li>
  <li><a href="/work/">Work</a></li>
  <li><a href="/clients/">Clients</a></li>
  <li><a href="/contact/">Contact</a></li>
</ul>
Posted by: Guest on May-05-2021

Code answers related to "how to center topnav bar in html"

Browse Popular Code Answers by Language