Here you have the code and demo version of the problem. if you see the last two black boxes are in center is there a way to make them show on left side ?
mainparent
{
width:500px;
height:200px;
text-align:center;
background:#ccc;
}
.boxes
{
width:50px;
height:50px;
display:inline-block;
margin-left:5px;
background:#000;
}
Why not just float them left ? (and resize your container to fit them..)
This way you have better control of the margins, since the
font-size
does not affect them (nor the whitespace)Demo at http://jsfiddle.net/JxhP8/32/
Update
If you want the elements left aligned amongst themselves but center aligned in their container, you will need another element in the middle and some javascript..
Here is a jquery implementation
html
css
jquery
Demo at http://jsfiddle.net/JxhP8/34/