Reputation: 912
I have 4 divs inside another one.
I want inside divs
to have equals margins between them so there is the same space between left edge of root div
and first inside div
, between two inside div
and between last inside div
and the right edge of root.
Now i can see this
Is there any way to do this with any specially property of CSS? Or i had to assign margins manually?
Thanks!
Upvotes: 1
Views: 818
Reputation: 21492
#root{
background: red;
width: 400px;
font-size:0;
}
#root > div{
display: inline-block;
width: 50px;
height: 50px;
background: blue;
margin-left: calc((100% - 200px) / 5); /* Pre-calced 40px */
}
jsfiddle: http://jsfiddle.net/rXYqR/2/
Upvotes: 3