you are taking this text-align:justify;
wrong. actually there is a difference between justify and display: inline;
. if you look at the code of the person who's answer was accepted then you will find that he has used both the thing i.e. text-align: justify
and display: inline
as the properties of different element and for different purpose.
the place where he has used the text-align:justify;
property of container which tell the container to have a proper spacing between its contents and he has used display:inline;
as the property of all box es to order them to arrange in a line
if you will only use display:inline
then it will only display them in a line without caring about proper spacing but if you define text-align:justify;
then itt will going to care about proper spacing or i should say equal padding from the border of the container
look the difference between the code of this guy... actually he has added a lot of css to make it more attractive but i have deleted all the stuff just to explain you:
code without text-align:justify;
:
#container {
border: 2px dashed #444;
height: 125px;
/* just for demo */
min-width: 612px;
}
.box1, .box2, .box3, .box4 {
width: 150px;
height: 125px;
vertical-align: top;
display: inline-block;
}
code with text-align:justify;
#container {
border: 2px dashed #444;
height: 125px;
text-align: justify;
/* just for demo */
min-width: 612px;
}
.box1, .box2, .box3, .box4 {
width: 150px;
height: 125px;
vertical-align: top;
display: inline-block;
}