Responsive square images

Responsive 3x3 grid of square images. 3 Columns and 3 rows.

by hoss

HTML

<!-- 1st row verticaly centered text in the square columns -->

<div class="square img_1-1">
</div>
<div class="square img_1-2">
</div>
<div class="square img_1-3">
</div>

<!-- 2nd row verticaly centered images in square columns -->

<div class="square img_2-1">
</div>
<div class="square img_2-2">
</div>
<div class="square img_2-3">
</div>

<!-- 3rd row responsive images in background with centered content -->

<div class="square img_3-1">
</div>
<div class="square img_3-2">
</div>
<div class="square img_3-3">
</div>

<!-- END OF LAYOUT, following juts for the demo -->

<div id="bottom">
    <p>If you want to see this grid with different content (text, inline images or lists), you can check this out: <br/>
        <a href="http://jsfiddle.net/webtiki/MpXYr/">Responsive 3x3 square grid</a></p> 
    <a href="http://stackoverflow.com/users/1811992/web-tiki">web-tiki</a>
</div>

CSS

@import url(http://fonts.googleapis.com/css?family=Lato:400,900);  /* <-- Just for the demo, Yes I like pretty fonts... */

.square {
    float:left;
    position: relative;
    width: 30%;
    padding-bottom : 30%; /* = width for a 1:1 aspect ratio */
    margin:1.66%;
    background-position:center center;
    background-repeat:no-repeat;
    background-size:cover; /* you change this to "contain" if you don't want the images to be cropped */
}

.img_1-1{background-image:url('https://farm4.staticflickr.com/3766/12953056854_b8cdf14f21.jpg');}
.img_1-2{background-image:url('https://farm7.staticflickr.com/6092/6227418584_d5883b0948.jpg');}
.img_1-3{background-image:url('https://farm8.staticflickr.com/7187/6895047173_d4b1a0d798.jpg');}

.img_2-1{background-image:url('https://farm8.staticflickr.com/7163/6822904141_50277565c3.jpg');}
.img_2-2{background-image:url('https://farm7.staticflickr.com/6139/5986939269_10721b8017.jpg');}
.img_2-3{background-image:url('https://farm4.staticflickr.com/3165/5733278274_2626612c70.jpg');}

.img_3-1{background-image:url('https://farm9.staticflickr.com/8429/7862595906_8f953fd25b.jpg');}
.img_3-2{background-image:url('https://farm7.staticflickr.com/6083/6055581292_d94c2d90e3.jpg');}
.img_3-3{background-image:url('https://farm4.staticflickr.com/3771/13199704015_72aa535bd7.jpg');}




/*  following just for the demo */


body {
    font-size:20px;
    font-family: 'Lato',verdana, sans-serif;
    color: #fff;
    text-align:center;
    background:#ECECEC;
}

#bottom {
    clear:both;
    margin:0 1.66%;
    width:89.68%;
    padding: 3.5%;
    background-color:#1E1E1E;
    color: #fff;
}
#bottom p{
    text-align:center;
    line-height:2em;
}
#bottom a{
    color: #000;
    text-decoration:none;
    border:1px solid #000;
    padding:10px 20px 12px;
    line-height:70px;
    background:#ccc;
    
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
}

#bottom a:hover{
    background:#ECECEC;
    border:1px...