you accept this text-align:justify; wrong. there is actually a difference between justify and display: inline; . if you look at the code of the person whose answer was accepted, you will find that he used both the thing ie text-align: justify and display: inline as properties of another element and for different purposes.
the place where he used the text-align:justify; property text-align:justify; a container that tells the container the correct location between its contents, and he used display:inline; as a property of all fields to arrange them in a row
if you use only display:inline , then it will only display them in a row, not caring about the correct distance, but if you define text-align:justify; then itt will take care of the right distance or should I say that equal padding from the container border
Look at the difference between this guyโs code ... in fact, he added a lot of css to make it more attractive, but I deleted everything just to explain to you:
code without text-align:justify; :
#container { border: 2px dashed #444; height: 125px; 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; min-width: 612px; } .box1, .box2, .box3, .box4 { width: 150px; height: 125px; vertical-align: top; display: inline-block; }
source share