Skip to content

Instantly share code, notes, and snippets.

@trub
Created April 24, 2014 00:44
Show Gist options
  • Save trub/11237561 to your computer and use it in GitHub Desktop.
Save trub/11237561 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="grid-items">
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_1.png" alt="">
<h1>Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item grid-item-big grid-item-image">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_2.png" alt="">
<h1>Grid Item With an Image</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item grid-item-big">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_3.png" alt="">
<h1>Another Wide Item</h1>
<p>Lorem ipsum consectetur dolor sit amet, consectetur adipisicing elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_2.png" alt="">
<h1>Last Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_2.png" alt="">
<h1>Last Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_3.png" alt="">
<h1>A Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_1.png" alt="">
<h1>Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
</div>
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// Bitters (v)
// Bourbon (v)
// Neat (v)
// ----
@import "bourbon/bourbon";
@import "neat/neat";
@import "bitters/bitters";
$large-screen: 10em;
$medium-screen: 8em;
@mixin grid-item-columns($columns) {
width: (100% / 12) * $columns;
}
.grid-items {
$grid-items-background: $base-body-color;
$grid-item-background: desaturate($base-accent-color, 30);
$grid-item-colors:
desaturate($base-accent-color, 30),
#3581A5,
#5FBEBE,
#98C79A,
#A7A891,
#BDCC97,
#979EA0;
$grid-item-border-size: 9px;
$grid-item-columns: 4;
$grid-item-big-columns: 8;
$grid-item-color: white;
$grid-item-height: 14em;
@include clearfix;
.grid-item {
@include transition (all 0.2s ease-in-out);
height: $grid-item-height;
background: $grid-item-background;
width: 100%;
overflow: hidden;
float: left;
padding: 2em;
border-top: 0;
border-bottom: $grid-item-border-size solid $grid-items-background;
border-left: $grid-item-border-size /2 solid $grid-items-background;
border-right: $grid-item-border-size /2 solid $grid-items-background;
text-align: center;
cursor: pointer;
@include media($large-screen) {
@include grid-item-columns($grid-item-columns);
}
@for $i from 1 to 8 { // assign colors from $grid-item-colors list
&:nth-child(#{$i}) {
$background-from-list: nth($grid-item-colors, $i);
background-color: $background-from-list;
box-shadow: inset 0px 0px 1px 2px darken($background-from-list, 10);
&:hover {
background-color: darken($background-from-list, 10);
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
}
}
}
.grid-item img {
display: block;
height: 3em;
margin: auto;
margin-bottom: 1em;
}
.grid-item h1 {
color: $grid-item-color;
font-size: 1.3em;
margin-bottom: .4em;
}
.grid-item p {
margin: auto;
color: transparentize($grid-item-color, .3);
@include media($medium-screen) {
max-width: 70%;
}
}
.grid-item-big {
@include media($large-screen) {
@include grid-item-columns($grid-item-big-columns);
}
p {
@include media($medium-screen) {
max-width: 60%;
}
}
}
.grid-item-image {
background: url(https://raw.github.com/Magnus-G/Random/master/lake-transparent.png);
background-color: $grid-item-background;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
button,
input[type="submit"] {
border: 1px solid #2459a6;
border-radius: 3px;
box-shadow: inset 0 1px 0 0 #89a8d5;
color: white;
display: inline-block;
font-size: inherit;
font-weight: bold;
background-color: #477dca;
background-image: -webkit-linear-gradient(#477dca, #2760b2);
background-image: linear-gradient(#477dca, #2760b2);
padding: 7px 18px;
text-decoration: none;
text-shadow: 0 1px 0 #1b4f9a;
background-clip: padding-box;
font-size: 1em;
}
button:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled) {
box-shadow: inset 0 1px 0 0 #628cc8;
cursor: pointer;
background-color: #3c71bb;
background-image: -webkit-linear-gradient(#3c71bb, #255aa5);
background-image: linear-gradient(#3c71bb, #255aa5);
}
button:active:not(:disabled),
input[type="submit"]:active:not(:disabled) {
border: 1px solid #2459a6;
box-shadow: inset 0 0 8px 4px #235397, inset 0 0 8px 4px #235397, 0 1px 1px 0 #eeeeee;
}
button:disabled,
input[type="submit"]:disabled {
opacity: 0.5;
cursor: not-allowed;
}
body {
color: #333333;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1em;
-webkit-font-smoothing: antialiased;
line-height: 1.5em;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
line-height: 1.25em;
margin: 0;
text-rendering: optimizeLegibility;
}
h1 {
font-size: 2.25em;
}
h2 {
font-size: 2em;
}
h3 {
font-size: 1.75em;
}
h4 {
font-size: 1.5em;
}
h5 {
font-size: 1.25em;
}
h6 {
font-size: 1em;
}
p {
margin: 0 0 0.75em;
}
a {
color: #477dca;
text-decoration: none;
-webkit-transition: color 0.1s linear;
-moz-transition: color 0.1s linear;
transition: color 0.1s linear;
}
a:hover {
color: #2c5999;
}
a:active, a:focus {
color: #2c5999;
outline: none;
}
hr {
border-bottom: 1px solid #dddddd;
border-left: none;
border-right: none;
border-top: none;
margin: 1.5em 0;
}
img {
margin: 0;
max-width: 100%;
}
abbr, acronym {
border-bottom: 1px dotted #dddddd;
cursor: help;
}
address {
display: block;
margin: 0 0 0.75em;
}
hgroup {
margin-bottom: 0.75em;
}
del {
color: #595959;
}
blockquote {
border-left: 2px solid #dddddd;
color: #595959;
margin: 1.5em 0;
padding-left: 0.75em;
}
cite {
color: #737373;
font-style: italic;
}
cite:before {
content: '\2014 \00A0';
}
fieldset {
background: #f7f7f7;
border: 1px solid #dddddd;
margin: 0 0 0.75em 0;
padding: 1.5em;
}
input,
label,
select {
display: block;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1em;
}
label {
font-weight: bold;
margin-bottom: 0.375em;
}
label.required:after {
content: "*";
}
label abbr {
display: none;
}
textarea,
input[type="email"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="url"], input[type="color"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="month"], input[type="time"], input[type="week"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: border-color;
-moz-transition: border-color;
transition: border-color;
background-color: white;
border-radius: 0.1875em;
border: 1px solid #dddddd;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1em;
margin-bottom: 0.75em;
padding: 0.5em 0.5em;
resize: vertical;
width: 100%;
}
textarea:hover,
input[type="email"]:hover, input[type="number"]:hover, input[type="password"]:hover, input[type="search"]:hover, input[type="tel"]:hover, input[type="text"]:hover, input[type="url"]:hover, input[type="color"]:hover, input[type="date"]:hover, input[type="datetime"]:hover, input[type="datetime-local"]:hover, input[type="month"]:hover, input[type="time"]:hover, input[type="week"]:hover {
border-color: #c4c4c4;
}
textarea:focus,
input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus {
border-color: #477dca;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 5px rgba(55, 112, 192, 0.7);
outline: none;
}
input[type="search"] {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
input[type="checkbox"], input[type="radio"] {
display: inline;
margin-right: 0.375em;
}
input[type="file"] {
width: 100%;
}
select {
width: auto;
margin-bottom: 1.5em;
}
button,
input[type="submit"] {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
cursor: pointer;
user-select: none;
vertical-align: middle;
white-space: nowrap;
}
table {
border-collapse: collapse;
margin: 0.75em 0;
table-layout: fixed;
width: 100%;
}
th {
border-bottom: 1px solid #b7b7b7;
font-weight: bold;
padding: 0.75em 0;
text-align: left;
}
td {
border-bottom: 1px solid #dddddd;
padding: 0.75em 0;
}
tr, td, th {
vertical-align: middle;
}
ul, ol {
margin: 0;
padding: 0;
list-style-type: none;
}
dl {
line-height: 1.5em;
margin-bottom: 0.75em;
}
dl dt {
font-weight: bold;
margin-top: 0.75em;
}
dl dd {
margin: 0;
}
.error, #flash_failure {
background: #fbe3e4;
color: #96151b;
font-weight: bold;
margin-bottom: 0.75em;
padding: 0.75em;
}
.error a, #flash_failure a {
color: #6a0f13;
}
.error a:hover, #flash_failure a:hover {
color: #110203;
}
.notice, #flash_notice {
background: #fff6bf;
color: #8c7800;
font-weight: bold;
margin-bottom: 0.75em;
padding: 0.75em;
}
.notice a, #flash_notice a {
color: #594c00;
}
.notice a:hover, #flash_notice a:hover {
color: black;
}
.success, #flash_success {
background: #e6efc2;
color: #56651a;
font-weight: bold;
margin-bottom: 0.75em;
padding: 0.75em;
}
.success a, #flash_success a {
color: #333c10;
}
.success a:hover, #flash_success a:hover {
color: black;
}
.grid-items:after {
content: "";
display: table;
clear: both;
}
.grid-items .grid-item {
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
height: 14em;
background: #6b83a6;
width: 100%;
overflow: hidden;
float: left;
padding: 2em;
border-top: 0;
border-bottom: 9px solid white;
border-left: 4.5px solid white;
border-right: 4.5px solid white;
text-align: center;
cursor: pointer;
}
@media screen and (min-width: 10em) {
.grid-items .grid-item {
width: 33.33333%;
}
}
.grid-items .grid-item:nth-child(1) {
background-color: #6b83a6;
box-shadow: inset 0px 0px 1px 2px #536a8b;
}
.grid-items .grid-item:nth-child(1):hover {
background-color: #536a8b;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item:nth-child(2) {
background-color: #3581a5;
box-shadow: inset 0px 0px 1px 2px #29637e;
}
.grid-items .grid-item:nth-child(2):hover {
background-color: #29637e;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item:nth-child(3) {
background-color: #5fbebe;
box-shadow: inset 0px 0px 1px 2px #44a6a6;
}
.grid-items .grid-item:nth-child(3):hover {
background-color: #44a6a6;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item:nth-child(4) {
background-color: #98c79a;
box-shadow: inset 0px 0px 1px 2px #77b57a;
}
.grid-items .grid-item:nth-child(4):hover {
background-color: #77b57a;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item:nth-child(5) {
background-color: #a7a891;
box-shadow: inset 0px 0px 1px 2px #909175;
}
.grid-items .grid-item:nth-child(5):hover {
background-color: #909175;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item:nth-child(6) {
background-color: #bdcc97;
box-shadow: inset 0px 0px 1px 2px #a7bb75;
}
.grid-items .grid-item:nth-child(6):hover {
background-color: #a7bb75;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item:nth-child(7) {
background-color: #979ea0;
box-shadow: inset 0px 0px 1px 2px #7c8588;
}
.grid-items .grid-item:nth-child(7):hover {
background-color: #7c8588;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
.grid-items .grid-item img {
display: block;
height: 3em;
margin: auto;
margin-bottom: 1em;
}
.grid-items .grid-item h1 {
color: white;
font-size: 1.3em;
margin-bottom: .4em;
}
.grid-items .grid-item p {
margin: auto;
color: rgba(255, 255, 255, 0.7);
}
@media screen and (min-width: 8em) {
.grid-items .grid-item p {
max-width: 70%;
}
}
@media screen and (min-width: 10em) {
.grid-items .grid-item-big {
width: 66.66667%;
}
}
@media screen and (min-width: 8em) {
.grid-items .grid-item-big p {
max-width: 60%;
}
}
.grid-items .grid-item-image {
background: url(https://raw.github.com/Magnus-G/Random/master/lake-transparent.png);
background-color: #6b83a6;
background-repeat: no-repeat;
background-position: top;
background-size: cover;
}
<div class="grid-items">
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_1.png" alt="">
<h1>Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item grid-item-big grid-item-image">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_2.png" alt="">
<h1>Grid Item With an Image</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item grid-item-big">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_3.png" alt="">
<h1>Another Wide Item</h1>
<p>Lorem ipsum consectetur dolor sit amet, consectetur adipisicing elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_2.png" alt="">
<h1>Last Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_2.png" alt="">
<h1>Last Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_3.png" alt="">
<h1>A Grid Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
<a href="javascript:void(0)" class="grid-item">
<img src="https://raw.github.com/Magnus-G/Random/master/placeholder_logo_1.png" alt="">
<h1>Item</h1>
<p>Lorem ipsum dolor sit amet, elit. Rem, illum.</p>
</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment