I am not sure why "element one" is not centered. The div with class name "navBar" is effecting the text in the div below. I'm not sure why "element one" is not centered. When i remove the "navBar" div it is fixed so I know it is because of that. Also, when I remove some of attributes like float:right, "element one" will change positions, but will not stay centered.
Thanks!
html,
body {
height: 100%;
background-color: #231C18;
font-family: 'Cabin', sans-serif;
}
body {
margin: 0;
}
.flex-container {
padding: 0;
margin: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
justify-content: center;
}
.navBar {
height: 50px;
line-height: 50px;
}
.bar {
margin: 10px;
color: white;
text-decoration: none;
}
.title {
float: left;
font-size: 40px;
}
.right {
float: right;
}
.balance {
background-color: #1A1411;
border-radius: 5px;
text-align: center;
}
.bottom {
text-decoration: none;
margin: 10px;
color: #F7F7F7;
}
.flex-item {
background-color: #1A1411;
padding: 5px;
width: 90vw;
max-width: 700px;
height: 40px;
margin: 10px;
color: white;
font-weight: bold;
font-size: 2em;
text-align: center;
border-radius: 5px;
}
.ad {
height: 300px;
}
<div class="flex-container">
<div class="row">
<div class="navBar">
<a class="bar title" href="#">title</a>
<a class="bar right" href="#">three</a>
<a class="bar right" href="#">two</a>
<a class="bar right" href="#">one</a>
<a class="bar right balance" href="#">balance</a>
</div>
<div class="flex-item">element one</div>
<div class="flex-item ad">element two</div>
<div>
<a class="bottom" href="#">placeholder</a>
</div>
</div>
</div>