Basic HTML: place images on the same line with the same distance from each other

My goal is to place 3 images on the same line with the same distance from each other, as shown in the figure below (provided that 2 arrows have the same length).

As it should look like.

Now my solution is very ugly that breaks if the window size is too small:

<h1>
    <div style="width:105px; height:30px; float:left; margin-top:25px;">
        <img src="image1.png"/>
    </div>
    <div style="width:190px; height:30px; float:left; margin-top:25px; margin-left:30%; margin-right:30%;">
        <img src="image2.png"/>
    </div>
    <div style="width:102px; height:30px; float:right; margin-top:25px;">
        <img src="image3.png"/>
    </div>
    <div style="clear: both;">
    </div>
</h1>

I would prefer a β€œclean” solution, but my HTML positioning knowledge is still too limited. Any help would be appreciated.

+1
source share
1 answer

Usetext-align: justify :

<div class="outer">
  <img src="http://placehold.it/50x100" />
  <img src="http://placehold.it/150x100" />
  <img src="http://placehold.it/50x100" />
  <span class="fix"></span>
</div>
.outer {
    text-align: justify;
}
.outer img {
    display: inline-block;
    vertical-align: center;
}
.outer .fix {
    width: 100%;
    height: 0;
    display: inline-block;
}

In most browsers, you can remove this range .fixand add :

.outer::after {
    width: 100%;
    height: 0;
    display: inline-block;
    content: "";
}
+2
source

All Articles