Skip to content

Instantly share code, notes, and snippets.

@hilja
Last active January 12, 2019 11:00
Show Gist options
  • Save hilja/87a4712ae1a328b0351e to your computer and use it in GitHub Desktop.
Save hilja/87a4712ae1a328b0351e to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<h1>Horses with backgorunds!</h1>
<div class="horses--horse"></div>
<div class="horses--pony"></div>
<div class="horses--maxi-pony"></div>
<div class="horses--mini-horse"></div>
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
$omni: 20px;
// Our two dimentional list
$horses: (pony #996633)
(horse Pink)
(mini-horse #333)
(maxi-pony #cc9849);
// Base styles for the horses
[class^="horses"] {
background-size: 100%;
background-repeat: no-repeat;
float: left;
border: solid $omni #fff;
border-width: 0 $omni 0 0;
height: 200px;
width: 25%;
}
// Horse loop
@each $horse in $horses {
.horses--#{nth($horse, 1)} {
background-color: nth($horse, 2);
background-image: url('http://hilja.net/i/#{nth($horse, 1)}.png');
}
}
// Just some reset stuff
body {
font-family: sans-serif;
margin: $omni 0 $omni $omni;
}
* {
box-sizing: border-box;
}
[class^="horses"] {
background-size: 100%;
background-repeat: no-repeat;
float: left;
border: solid 20px #fff;
border-width: 0 20px 0 0;
height: 200px;
width: 25%;
}
.horses--pony {
background-color: #996633;
background-image: url("http://hilja.net/i/pony.png");
}
.horses--horse {
background-color: Pink;
background-image: url("http://hilja.net/i/horse.png");
}
.horses--mini-horse {
background-color: #333;
background-image: url("http://hilja.net/i/mini-horse.png");
}
.horses--maxi-pony {
background-color: #cc9849;
background-image: url("http://hilja.net/i/maxi-pony.png");
}
body {
font-family: sans-serif;
margin: 20px 0 20px 20px;
}
* {
box-sizing: border-box;
}
<h1>Horses with backgorunds!</h1>
<div class="horses--horse"></div>
<div class="horses--pony"></div>
<div class="horses--maxi-pony"></div>
<div class="horses--mini-horse"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment