Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can do this with CSS3 <code>column-count</code>, assuming you at least have a single containing element. This method has the advantage of changing layout easily (for a mobile device, for example) by simply adding a class. </p> <p>Output:</p> <p><img src="https://i.stack.imgur.com/elSor.png" alt="enter image description here"></p> <p>Demo: <a href="http://jsfiddle.net/ThinkingStiff/rS95S/" rel="noreferrer">http://jsfiddle.net/ThinkingStiff/rS95S/</a></p> <p>CSS:</p> <pre class="lang-css prettyprint-override"><code>#container { column-count: 3; column-fill: balance; column-gap: 10px; width: 330px; } .image { display: block; margin-bottom: 10px; width: 100px; } </code></pre> <p>HTML:</p> <pre class="lang-html prettyprint-override"><code>&lt;div id="container"&gt; &lt;img class="image" src="http://farm1.staticflickr.com/205/494701000_744cc3a83a_z.jpg" /&gt; &lt;img class="image" src="http://farm5.staticflickr.com/4028/4287569889_f6a4fca31b_z.jpg" /&gt; &lt;img class="image" src="http://farm3.staticflickr.com/2340/2421926504_d8509d0a98_z.jpg" /&gt; &lt;img class="image" src="http://farm1.staticflickr.com/197/503792921_fedf8ba47e_z.jpg" /&gt; &lt;img class="image" src="http://farm2.staticflickr.com/1153/741035029_f394e11a1f_z.jpg" /&gt; &lt;img class="image" src="http://farm7.staticflickr.com/6213/6243090894_8b8dd862cd_z.jpg" /&gt; &lt;img class="image" src="http://farm2.staticflickr.com/1339/1157653249_dbcc93c158_z.jpg?zz=1" /&gt; &lt;img class="image" src="http://farm3.staticflickr.com/2570/4220856234_029e5b8348_z.jpg?zz=1" /&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload