How can I position Label #2 and Label #3 in the center of the panel
div given that Label #1 and Label #4 are floating left and right, respectively.
I would also like to move Label #2 and Label #3 below Label #1 and Label #4 when the browser width reaches a certain height. So Label #1 and Label #4 should be together, as should be Label #2 and Label #3 right below them.
See my example here: http://jsfiddle.net/p7ws5cxx
html, body {
font-family:'Helvetica Neue', Arial, sans-serif;
font-size: 14px;
font-weight: 500;
}
#panel {
width: 100%;
background: #ddd;
display: block;
height: auto;
float: left;
}
.box-1, .box-2, .box-3, .box-4 {
border: 2px solid #aaa;
background: #fff;
padding: 1em;
width: auto;
float: left;
border-radius: 2px;
display: inline-block;
}
.center-box {
margin: 0 auto;
float :left;
border: 1px solid blue;
text-align: center;
}
.box-4 {
float: right;
}
@media screen and (max-width: 568px) {
.box-1, .box-4 {
width: 50%;
float: left;
}
.center-box {
margin: 0 auto;
}
}
<div id="panel">
<span class="box-1">Label #1</span>
<div class="center-box">
<span class="box-2">Label #2</span>
<span class="box-3">Label #3</span>
</div>
<span class="box-4">Label #4</span>
</div>