Skip to content

Instantly share code, notes, and snippets.

@una
Last active November 18, 2015 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save una/c406c3cc0c6e8b4338d8 to your computer and use it in GitHub Desktop.
Save una/c406c3cc0c6e8b4338d8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="card">
<h1 class="data-header">Unstyled Card Shared Styles</h1>
<p class="data-subtitle">shared styles of both cards</p>
</div>
<div class="card--primary">
<h1 class="data-header">Header on Primary Card</h1>
<p class="data-subtitle">subtitle on primary card</p>
</div>
<div class="card--secondary">
<h1 class="data-header">Header on Secondary Card</h1>
<p class="data-subtitle">subtitle on secondary card</p>
</div>
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$color--card-header: pink;
$color--subtitle: lightgray;
$color--card-bg: navy;
$color--card-outline: hotpink;
$color--text: black;
$color--secondary: tomato;
$color--text--inverted: invert($color--text);
%card {
display: inline-block;
max-width: 20em;
padding: 1em 2em;
margin: .5em;
font-family: 'Open Sans', sans-serif;
.data-header {
font-size: 2.4em;
}
.data-subtitle {
font-size: 1.2em;
color: $color--subtitle;
font-style: italic;
}
}
.card {
@extend %card; // should we do this? this is optional.
&--primary {
@extend %card;
background-color: $color--card-bg;
outline: 4px solid $color--card-outline;
color: $color--text;
.data-header {
color: $color--card-header;
}
}
&--secondary {
@extend %card;
background-color: $color--secondary;
color: $color--text--inverted;
.data-header {
color: $color--text;
}
}
}
.card, .card--primary, .card--secondary {
display: inline-block;
max-width: 20em;
padding: 1em 2em;
margin: .5em;
font-family: 'Open Sans', sans-serif;
}
.card .data-header, .card--primary .data-header, .card--secondary .data-header {
font-size: 2.4em;
}
.card .data-subtitle, .card--primary .data-subtitle, .card--secondary .data-subtitle {
font-size: 1.2em;
color: lightgray;
font-style: italic;
}
.card--primary {
background-color: navy;
outline: 4px solid hotpink;
color: black;
}
.card--primary .data-header {
color: pink;
}
.card--secondary {
background-color: tomato;
color: white;
}
.card--secondary .data-header {
color: black;
}
<div class="card">
<h1 class="data-header">Unstyled Card Shared Styles</h1>
<p class="data-subtitle">shared styles of both cards</p>
</div>
<div class="card--primary">
<h1 class="data-header">Header on Primary Card</h1>
<p class="data-subtitle">subtitle on primary card</p>
</div>
<div class="card--secondary">
<h1 class="data-header">Header on Secondary Card</h1>
<p class="data-subtitle">subtitle on secondary card</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment