I have the following setup, but setting the width of the divs to a something around 30% is not working consistently (once the window width goes less than some number the third divs drops below..
Is there a better way of doing this, so that my divs always stay inline and keep getting smaller and smaller while the margin stays fixed at 18px between them ?
CSS :
.parent {
width: 100%;
height: 50px;
}
.child {
float: left;
margin-right: 18px;
border: 2px solid white;
text-align: center;
line-height: 50px;
height: 100%;
width: ~30%; /* doesn't work */
}
.child:nth-child(3) {
margin-right: 0;
}
HTML :
<div class="parent">
<div class="child">one</div>
<div class="child">two</div>
<div class="child">three</div>
</div>