Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should use <a href="http://www.w3.org/TR/css3-mediaqueries/" rel="nofollow">media queries</a> and percentage widths .. </p> <p>That way you can define in the media queries how many columns you want by specifying the width of the child elements (<em>in percentages that add up perfectly to 100%</em>), and by making the images be <code>width:100%</code> inside those elements you make them auto scale..</p> <p><strong>Demo at</strong> <a href="http://jsfiddle.net/gaby/Yz7mf/1/" rel="nofollow">http://jsfiddle.net/gaby/Yz7mf/1/</a><br> (<em>fullscreen at <a href="http://fiddle.jshell.net/gaby/Yz7mf/1/show/light/" rel="nofollow">http://fiddle.jshell.net/gaby/Yz7mf/1/show/light/</a></em>)</p> <p>So for a structure of </p> <pre><code>&lt;div id="container"&gt; &lt;div class="item"&gt;&lt;img src="http://lorempixel.com/200/150/city/1" /&gt;&lt;/div&gt; &lt;div class="item"&gt;&lt;img src="http://lorempixel.com/200/150/city/2" /&gt;&lt;/div&gt; &lt;div class="item"&gt;&lt;img src="http://lorempixel.com/200/150/city/3" /&gt;&lt;/div&gt; &lt;div class="item"&gt;&lt;img src="http://lorempixel.com/200/150/city/4" /&gt;&lt;/div&gt; &lt;div class="item"&gt;&lt;img src="http://lorempixel.com/200/150/city/5" /&gt;&lt;/div&gt; &lt;div class="item"&gt;&lt;img src="http://lorempixel.com/200/150/city/6" /&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>You can use a Css of</p> <pre><code>#container{ overflow:auto; } #container &gt; div{ float:left; } #container &gt; div &gt; img{ width:100%; display:block; } @media screen and (max-width:400px){ #container &gt; div{ width:50%; } } @media screen and (min-width:401px) and (max-width:600px){ #container &gt; div{ width:25%; } } @media screen and (min-width:601px){ #container &gt; div{ width:20%; } } </code></pre> <p>This means that when the browser has width up to 400px use 2 columns, for width between 401px and 600px use 4 columns and for widths larger than 600px use 5 columns.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. 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