Skip to content

Instantly share code, notes, and snippets.

@jensgro
Created August 27, 2014 17:14
Show Gist options
  • Save jensgro/7cbaa5d1b39020003444 to your computer and use it in GitHub Desktop.
Save jensgro/7cbaa5d1b39020003444 to your computer and use it in GitHub Desktop.
25%-grids with Zen-Grids
<div>
<div class="ym-g25-1">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
<div class="ym-g25-2">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
<div class="ym-g25-3">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
<div class="ym-g25-4">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
</div>
// ----
// Sass (v3.3.14)
// Compass (v1.0.0)
// Zen Grids (v1.4)
// ----
@import "zen";
$zen-column-count: 4; // Set the total number of columns in the grid.
$zen-gutter-width: 10px;
.ym-g25-1 {
@include zen-grid-item(1, 1);
}
.ym-g25-2 {
@include zen-grid-item(1, 2);
}
.ym-g25-3 {
@include zen-grid-item(1, 3);
}
.ym-g25-4 {
@include zen-grid-item(1, 4);
}
// --------------
.img-teaser {
position: relative;
}
.img-teaser img {
width: 100%;
height: auto;
max-width: 100%;
display: block;
}
.img-teaser .teaserlink {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255, 255, 255, 0.85);
color: #e1001a;
padding: 20px;
font-size: 18px;
text-decoration: none;
overflow: hidden;
}
.img-teaser .teaserlink:hover, .img-teaser .teaserlink:focus {
background-color: rgba(255, 255, 255, 0.6);
text-decoration: underline;
}
.img-teaser .teaserlink:after {
content: "»";
float: right;
}
@charset "UTF-8";
.ym-g25-1 {
float: left;
width: 25%;
margin-left: 0%;
margin-right: -25%;
padding-left: 5px;
padding-right: 5px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
word-wrap: break-word;
}
.ym-g25-2 {
float: left;
width: 25%;
margin-left: 25%;
margin-right: -50%;
padding-left: 5px;
padding-right: 5px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
word-wrap: break-word;
}
.ym-g25-3 {
float: left;
width: 25%;
margin-left: 50%;
margin-right: -75%;
padding-left: 5px;
padding-right: 5px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
word-wrap: break-word;
}
.ym-g25-4 {
float: left;
width: 25%;
margin-left: 75%;
margin-right: -100%;
padding-left: 5px;
padding-right: 5px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
word-wrap: break-word;
}
.img-teaser {
position: relative;
}
.img-teaser img {
width: 100%;
height: auto;
max-width: 100%;
display: block;
}
.img-teaser .teaserlink {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255, 255, 255, 0.85);
color: #e1001a;
padding: 20px;
font-size: 18px;
text-decoration: none;
overflow: hidden;
}
.img-teaser .teaserlink:hover, .img-teaser .teaserlink:focus {
background-color: rgba(255, 255, 255, 0.6);
text-decoration: underline;
}
.img-teaser .teaserlink:after {
content: "»";
float: right;
}
<div>
<div class="ym-g25-1">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
<div class="ym-g25-2">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
<div class="ym-g25-3">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
<div class="ym-g25-4">
<div class="img-teaser">
<img src="http://placehold.it/230x240" alt="">
<a href="#" class="teaserlink">super-toller Link</a>
</div>
<!-- /.teaser -->
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment