Skip to content

Instantly share code, notes, and snippets.

@overthemike
Last active August 27, 2015 11:19
Show Gist options
  • Save overthemike/f58be57b5f23fab6a1f6 to your computer and use it in GitHub Desktop.
Save overthemike/f58be57b5f23fab6a1f6 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="media comment">
<div class="img"></div>
<div class="content "></div>
</div>
<div class="media product featured">
<div class="img"></div>
<div class="content"></div>
</div>
// ----
// libsass (v3.2.5)
// ----
body {padding:50px; background:beige;}
* {box-sizing: border-box;}
$comment_colors: (
"img-bg": lightblue,
"solid-border": #777,
"dashed-border": #ddd,
"bg": #fff
);
@function comment_color($key) {
@if not map-has-key($comment_colors, $key) {
@warn "Key not found.";
}
@return map-get($comment_colors, $key);
}
$product-border: deepskyblue;
$product-bg: lightblue;
$product-featured-bg: #f00;
$product-featured-text-color: #fff;
$product-featured-text-content: "New!";
$product-img-bg: deepskyblue;
/* Structure */
.media {
width: 500px;
padding: 10px;
display: inline-block;
margin-left: 30px;
& > .img {
float: left;
width: 150px;
height: 150px;
}
& > .content {
margin-left: 160px;
min-height: 150px;
}
}
.comment {
background-color: comment-color(bg);
border: 3px solid comment-color(solid-border);
& > .img {
background-color: comment-color(img-bg);
}
& > .content {
border: 3px dashed comment-color(dashed-border);
}
}
.product {
background-color: $product_bg;
border: 3px solid $product_border;
position: relative;
& > .img {
background-color: $product_img_bg;
}
& > .content {
border: 3px dashed $product_border;
}
&.featured::before {
content: $product_featured_text_content;
color: $product_featured_text_color;
position: absolute;
left: -15px;
top: -15px;
border-radius: 50%;
background-color: $product_featured_bg;
width: 60px;
height: 40px;
text-align: center;
padding-top: 20px;
}
}
body {
padding: 50px;
background: beige;
}
* {
box-sizing: border-box;
}
/* Structure */
.media {
width: 500px;
padding: 10px;
display: inline-block;
margin-left: 30px;
}
.media > .img {
float: left;
width: 150px;
height: 150px;
}
.media > .content {
margin-left: 160px;
min-height: 150px;
}
.comment {
background-color: #fff;
border: 3px solid #777;
}
.comment > .img {
background-color: lightblue;
}
.comment > .content {
border: 3px dashed #ddd;
}
.product {
background-color: lightblue;
border: 3px solid deepskyblue;
position: relative;
}
.product > .img {
background-color: deepskyblue;
}
.product > .content {
border: 3px dashed deepskyblue;
}
.product.featured::before {
content: "New!";
color: #fff;
position: absolute;
left: -15px;
top: -15px;
border-radius: 50%;
background-color: #f00;
width: 60px;
height: 40px;
text-align: center;
padding-top: 20px;
}
<div class="media comment">
<div class="img"></div>
<div class="content "></div>
</div>
<div class="media product featured">
<div class="img"></div>
<div class="content"></div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment