Skip to content

Instantly share code, notes, and snippets.

@Phunky
Last active August 29, 2015 14:05
Show Gist options
  • Save Phunky/9000f61a3e9bed4ba73c to your computer and use it in GitHub Desktop.
Save Phunky/9000f61a3e9bed4ba73c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="cta-btn blue">Button</div>
<div class="cta-btn green">Button</div>
<div class="cta-btn red">Button</div>
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
$colours: (
header: #35383c,
headerDark: #1e2226,
blue: #0266C8,
green: #8fc968,
orange: #E06B1C,
red: #bd362f
);
@mixin vendor ($property, $value...) {
-webkit-#{$property}:$value;
-moz-#{$property}:$value;
-ms-#{$property}:$value;
-o-#{$property}:$value;
#{$property}:$value;
}
@mixin btn($name){
$color: map-get($colours, $name);
&.#{$name}{
background-color: $color;
border: none;
color: #fff;
&:hover {
background-color: darken($color, 10%);
}
}
}
.cta {
&-btn {
background: none;
border: 1px solid map-get($colours, header);
@include vendor(border-radius, 4px);
color: map-get($colours, header);
display: inline-block;
font-family: "Open Sans";
font-weight: 600;
height: auto;
margin: 0 0 2px;
overflow: hidden;
padding: 6px 10px;
position: relative;
width: auto;
@include btn(blue);
@include btn(green);
@include btn(red);
}
}
.cta-btn {
background: none;
border: 1px solid #35383c;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
color: #35383c;
display: inline-block;
font-family: "Open Sans";
font-weight: 600;
height: auto;
margin: 0 0 2px;
overflow: hidden;
padding: 6px 10px;
position: relative;
width: auto;
}
.cta-btn.blue {
background-color: #0266c8;
border: none;
color: #fff;
}
.cta-btn.blue:hover {
background-color: #014c96;
}
.cta-btn.green {
background-color: #8fc968;
border: none;
color: #fff;
}
.cta-btn.green:hover {
background-color: #73bb43;
}
.cta-btn.red {
background-color: #bd362f;
border: none;
color: #fff;
}
.cta-btn.red:hover {
background-color: #942a25;
}
<div class="cta-btn blue">Button</div>
<div class="cta-btn green">Button</div>
<div class="cta-btn red">Button</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment