Skip to content

Instantly share code, notes, and snippets.

@jensgro
Created August 27, 2014 16:34
Show Gist options
  • Save jensgro/4a7eef5148f1b0a29815 to your computer and use it in GitHub Desktop.
Save jensgro/4a7eef5148f1b0a29815 to your computer and use it in GitHub Desktop.
25%-grids with Singularity
<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)
// Singularity.gs (v1.2.0.rc.6)
// ----
@import "singularitygs";
@include add-grid(4);
.ym-g25-1 {
// Spanning the first column
@include grid-span(1, 1);
}
.ym-g25-2 {
// Spanning the 2nd column
@include grid-span(1, 2);
}
.ym-g25-3 {
// Spanning the 2nd column
@include grid-span(1, 3);
}
.ym-g25-4 {
// Spanning the 2nd column
@include grid-span(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 {
width: 21.05263%;
float: left;
margin-right: -100%;
margin-left: 0;
clear: none;
}
.ym-g25-2 {
width: 21.05263%;
float: left;
margin-right: -100%;
margin-left: 26.31579%;
clear: none;
}
.ym-g25-3 {
width: 21.05263%;
float: left;
margin-right: -100%;
margin-left: 52.63158%;
clear: none;
}
.ym-g25-4 {
width: 21.05263%;
float: right;
margin-left: 0;
margin-right: 0;
clear: none;
}
.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