Skip to content

Instantly share code, notes, and snippets.

@zellwk
Created June 29, 2015 09:26
Show Gist options
  • Save zellwk/9e94a472760cad7b6e0d to your computer and use it in GitHub Desktop.
Save zellwk/9e94a472760cad7b6e0d to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="container">
<div class="gallery">
<div class="gallery__item">
<img src="http://placehold.it/480x270" alt="">
</div>
<div class="gallery__item">
<img src="http://placehold.it/480x270" alt="">
</div>
<div class="gallery__item gallery__item--third">
<div class="gallery__item--height">
<a href="#">
<img src="http://placehold.it/480x270" alt="">
<span>Some Text</span>
</a>
<a href="#">
<img src="http://placehold.it/480x270" alt="">
<span>Some Text</span>
</a>
</div>
</div>
</div>
</div>
// ----
// Sass (v3.3.14)
// Compass (v1.0.3)
// Susy (v2.2.5)
// ----
@import "susy";
$susy: (columns: 12, gutters: 0.25, container: 1140px, debug: (image: show-columns));
img {
max-width: 100%;
height: auto;
}
.container {
@include container;
}
.gallery__item {
@include gallery(4 of 12);
}
.gallery__item--third {
.gallery__item--height {
position: relative;
height: 0;
padding-bottom: 56.25%;
}
a {
position: absolute;
top: 0;
left: 0;
right: 0;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
height: calc((100% - #{gutter(4)})/2);
}
a:last-child {
top: auto;
bottom: 0;
}
img {
height: 100%;
width: auto;
}
}
img {
max-width: 100%;
height: auto;
}
.container {
max-width: 1140px;
margin-left: auto;
margin-right: auto;
background-image: linear-gradient(to right, rgba(102, 102, 255, 0.25), rgba(179, 179, 255, 0.25) 80%, transparent 80%);
background-size: 8.47458%;
background-origin: content-box;
background-clip: content-box;
background-position: left top;
}
.container:after {
content: " ";
display: block;
clear: both;
}
.gallery__item {
width: 32.20339%;
float: left;
}
.gallery__item:nth-child(3n + 1) {
margin-left: 0;
margin-right: -100%;
clear: both;
margin-left: 0;
}
.gallery__item:nth-child(3n + 2) {
margin-left: 33.89831%;
margin-right: -100%;
clear: none;
}
.gallery__item:nth-child(3n + 3) {
margin-left: 67.79661%;
margin-right: -100%;
clear: none;
}
.gallery__item--third .gallery__item--height {
position: relative;
height: 0;
padding-bottom: 56.25%;
}
.gallery__item--third a {
position: absolute;
top: 0;
left: 0;
right: 0;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
height: calc((100% - 5.26316%)/2);
}
.gallery__item--third a:last-child {
top: auto;
bottom: 0;
}
.gallery__item--third img {
height: 100%;
width: auto;
}
<div class="container">
<div class="gallery">
<div class="gallery__item">
<img src="http://placehold.it/480x270" alt="">
</div>
<div class="gallery__item">
<img src="http://placehold.it/480x270" alt="">
</div>
<div class="gallery__item gallery__item--third">
<div class="gallery__item--height">
<a href="#">
<img src="http://placehold.it/480x270" alt="">
<span>Some Text</span>
</a>
<a href="#">
<img src="http://placehold.it/480x270" alt="">
<span>Some Text</span>
</a>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment