Skip to content

Instantly share code, notes, and snippets.

@geomarts
Created February 6, 2015 11:15
Show Gist options
  • Save geomarts/b24a9332d644f1be5123 to your computer and use it in GitHub Desktop.
Save geomarts/b24a9332d644f1be5123 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<h1>Thanks for taking a look!</h1>
<div class="btn"></div>
// ----
// Sass (v3.4.11)
// Compass (v1.0.3)
// ----
// Example-1
@function em-to-px($target, $context: 16px){
@return ($target / $context) * 1em;
}
// Example-2
@mixin ps-after($width, $width-value, $border-color: #BEEB9F) {
&:after {
content: '☺';
$random-width: random($width-value) * 1%;
#{$width}: $random-width;
height: $random-width;
$border-width: floor( ($random-width / 10%) * 1px ) + 1px;
border: $border-width solid $border-color;
display: block;
margin: 0 auto;
color: #FF6138;
}
}
// Example-3
$list: "tomato", "lime", "lightblue";
@mixin fg-color($property) {
@each $item in $list {
$color-length: str-length($item);
@if( $color-length % 2 != 0 ) {
#{$property}: unquote($item);
}
}
}
h1 {
margin-right: 5px;
text-align: center;
font-size: em-to-px(40px);
@include ps-after(width, 100);
@include fg-color(color);
}
// Example-4
$list-map : (success: lightgreen, alert: tomato, info: lightblue);
@mixin button-state($btn-state) {
@if (length($list-map) > 2 or length($list-map) < 5) {
$var : map-get($list-map, info);
background-color: lighten($var, 10%);
}
@each $state, $color in $list-map {
@if($state == $btn-state) {
border: 5px solid $color;
}
}
}
.btn {
width: 50px;
height: 50px;
@include button-state(success);
}
@charset "UTF-8";
h1 {
margin-right: 5px;
text-align: center;
font-size: 2.5em;
color: lightblue;
}
h1:after {
content: '☺';
width: 69%;
height: 69%;
border: 7px solid #BEEB9F;
display: block;
margin: 0 auto;
color: #FF6138;
}
.btn {
width: 50px;
height: 50px;
background-color: #d4ebf2;
border: 5px solid lightgreen;
}
<h1>Thanks for taking a look!</h1>
<div class="btn"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment