I've been fiddling around with nav bars and I just cannot figure out how to centre them. I am currently using this one from w3schools.com.
I would like the clickable boxes (Home, News, Contact, About me) to be in the centre of the page and not on the left. How do I do this?
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #4CAF50;
}
<ul>
<li>
<a class="active" href="#home">Home</a>
</li>
<li>
<a href="#news">News</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
<li>
<a href="#about">About</a>
</li>
</ul>