I'm trying to get 5 divs aligned inside a div
, like this:
Is there any way to do this without using margin-left?
I mean.. In case I want to eliminate one of this middle divs and they still be aligned? For example.. If I remove div4
, the others will be centered automatically. Like this:
I found a solution like this:
#parent {
width: 615px;
border: solid 1px #aaa;
text-align: center;
font-size: 20px;
letter-spacing: 35px;
white-space: nowrap;
line-height: 12px;
overflow: hidden;
}
.child {
width: 100px;
weight: 100px;
border: solid 1px #ccc;
display: inline-block;
vertical-align: middle;
}
But the problem is: The first div and the last one must be like float left and float right... And this solution centers every thing resulting something like this: