Created
April 16, 2013 12:04
-
-
Save bpainter/5395410 to your computer and use it in GitHub Desktop.
A CodePen by Bermon Painter. Mixin - Complex - Sass Version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Mixin - Complex</h1> | |
<p>You can create much more complex mixins that take multiple variables and help with the reuse of multiple types of CSS rules.</p> | |
<div class="message error"> | |
<p>Something terrible happened with the system and we can't proceed.</p> | |
<div class="close">x</div> | |
</div> | |
<div class="message caution"> | |
<p>Are you sure you want to do whatever you just did? It may not be a good idea..</p> | |
<div class="close">x</div> | |
</div> | |
<div class="message success"> | |
<p>Something great happened. We just wanted to let you know.</p> | |
<div class="close">x</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "compass"; | |
h1 { | |
font-size: 20px; | |
} | |
$error-color: #c15858; | |
$caution-color: #f2cf2f; | |
$success-color: #89a989; | |
@mixin rounded-corners($radius) { | |
-webkit-border-radius: $radius; | |
-moz-border-radius: $radius; | |
-ms-border-radius: $radius; | |
-o-border-radius: $radius; | |
border-radius: $radius; | |
} | |
.message { | |
float: left; | |
border-width: 1px; | |
border-style: solid; | |
@include rounded-corners(8px); | |
margin: 0 10px; | |
font-size: 14px; | |
padding: 20px; | |
position: relative; | |
width: 200px; | |
p { | |
margin: 0; | |
} | |
.close { | |
font-weight: bold; | |
position: absolute; | |
top: 5px; | |
right: 8px | |
} | |
} | |
.error { | |
background-color: $error-color; | |
border-color: darken($error-color, 30%); | |
color: darken($error-color, 40%); | |
.close { | |
color: darken($error-color, 30%); | |
} | |
} | |
@mixin message-box($color) { | |
background-color: $color; | |
border-color: darken($color, 30%); | |
color: darken($color, 40%); | |
.close { | |
color: darken($color, 30%); | |
} | |
} | |
.caution { | |
@include message-box($caution-color); | |
} | |
.success { | |
@include message-box($success-color); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment