Is there a way to center my navigation bar on the page? I've attempted using <center>
, but can't seem to get it right!
CSS:
.NavBar {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.NavItem {
float: left;
}
a:link, a:visited {
display: block;
width: 120px;
font-weight: bold;
color: #FFFFFF;
background-color: #080808;
text-align: center;
padding: 4px;
text-decoration: none;
text-transform: uppercase;
text
}
a:hover, a:active {
background-color: #7A991A;
}
HTML:
<ul class="NavBar">
<li class="NavItem"><a href="#home">Home</a></li>
<li class="NavItem"><a href="#news">Snippets of Divinity</a></li>
<li class="NavItem"><a href="#contact">Contact</a></li>
<li class="NavItem"><a href="#about">Donate</a></li>
</ul>
Apologies for the somewhat casual titles of the navigation buttons. I'm creating a website that showcases my thoughts and achievements.
Feel free to check out this JSFiddle link for reference: https://jsfiddle.net/ryfv3499/