Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's another method that has two main differences: avoids the use of background images (the use of which is semantically weird as Nightfirecat mentioned) and puts the images within an unordered list. The latter isn't necessary but is arguably follows CSS best practices.</p> <p>I haven't tested extensively but on recent Firefox, Chrome and IE for PC. I had to add a hack for IE7 based on <a href="http://www.brunildo.org/test/img_center.html" rel="nofollow">this page's suggestions</a>. That's the reason for the empty <code>&lt;span&gt;</code> for each list item.</p> <p>CSS:</p> <pre><code>&lt;style type="text/css"&gt; #boxes { list-style: none outside none; margin: 0; overflow: hidden; padding: 0; } #boxes li { float: left; border: 1px solid #333; margin: 30px; } #boxes li div { position: relative; width: 130px; height: 130px; text-align: center; display: block } #boxes li div img { position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto } &lt;/style&gt; &lt;!--[if IE 7]&gt; &lt;style type="text/css"&gt; #boxes li div * { vertical-align: middle; } #boxes li div img { position: relative; } #boxes li div span { display: inline-block; height: 100%; } &lt;/style&gt; &lt;![endif]--&gt; </code></pre> <p>HTML:</p> <pre><code>&lt;ul id="boxes"&gt; &lt;li&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="wide1.jpg"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="wide2.jpg"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="wide3.jpg"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="tall1.jpg"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="wide4.jpg"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="tall2.jpg"&gt;&lt;/div&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Done quickly, so it's entirely possible that there are some bugs.</p>
    singulars
    1. This table or related slice is empty.
    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