I am trying to center the items in a navbar (a div inside a div) but it either floats to the right or to the left, but never really in a center position.
(I'm using "navbar-default navbar-fixed-top" for the style of the navbar).
topnav2 is a "logo" that is perfectly placed to the left, but I want the items inside topnav to be placed in th center right next to the logo in topnav2.
.topnav a {
display: inline-block;
color: #777777;
padding: 14px 16px;
text-decoration: none;
font-size:22px;
letter-spacing: 1px;
}
.topnav2 a {
float: left;
display: block;
color: #777777;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size:22px;
letter-spacing: 1px;
}
<div class="navbar navbar-default navbar-fixed-top">
<div class="topnav2">
<a class="navtitle" href="index.html">Projekt</a>
</div>
<div class="topnav" id="myTopnav">
<a href="#" class="active">Home</a>
<a href="#">Platzhalter 1</a>
<a href="#">Platzhalter 2</a>
<a href="#">Platzhalter 3</a>
</div>
</div>
like mentioned above, topnav2 is placed perfectly how I want it, but I somehow couldn't figure out how to center topnav next to topnav2