Skip to content

Instantly share code, notes, and snippets.

@CheetoMao
Created November 27, 2015 16:14
Show Gist options
  • Save CheetoMao/cfcecb740ebef9ca496f to your computer and use it in GitHub Desktop.
Save CheetoMao/cfcecb740ebef9ca496f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="Flash Flash--warning">Here is a warning!</div>
<div class="Flash Flash--info">Boring info.</div>
<div class="Flash Flash--success">You did something right!</div>
<div class="Flash Flash--danger">DANGER!</div>
// ----
// libsass (v3.2.5)
// ----
//pre-existing color vars
$warning: orange;
$info: blue;
$success: green;
$danger: red;
// teensy bit o'styling
.Flash {
color: white;
display: block;
font-family: "Helvetica", sans-serif;
padding: 20px;
text-transform: uppercase;
}
// flash list
$flashes: (warning $warning),
(info $info),
(success $success),
(danger $danger);
// part that makes it work
@each $status in $flashes {
.Flash--#{nth($status, 1)} {
background: nth($status, 2);
}
}
.Flash {
color: white;
display: block;
font-family: "Helvetica", sans-serif;
padding: 20px;
text-transform: uppercase;
}
.Flash--warning {
background: orange;
}
.Flash--info {
background: blue;
}
.Flash--success {
background: green;
}
.Flash--danger {
background: red;
}
<div class="Flash Flash--warning">Here is a warning!</div>
<div class="Flash Flash--info">Boring info.</div>
<div class="Flash Flash--success">You did something right!</div>
<div class="Flash Flash--danger">DANGER!</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment