Skip to content

Instantly share code, notes, and snippets.

@Gonzalo2683
Created June 3, 2015 17:23
Show Gist options
  • Select an option

  • Save Gonzalo2683/02ad3e764a975e1b9531 to your computer and use it in GitHub Desktop.

Select an option

Save Gonzalo2683/02ad3e764a975e1b9531 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<a href="#" class="btn-loco">Hola</a>
<a href="#" class="btn-pill">Hola</a>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
@mixin miBoton($tipo, $colorText, $colorBorde,
$colorBG:null, $colorHover:null ){
// lineal
@if $tipo == lineal {
@include lineal($colorText, $colorBorde);
}
@if $tipo == pill {
@include pill($colorText, $colorBorde, $colorBG);
}
}
@mixin lineal($colorTexto, $colorBorde){
color: $colorTexto;
border-color: $colorBorde;
&:hover,
&:focus,
&.focus,
&:active,
&.active,
.open > &.dropdown-toggle {
color: darken($colorTexto,10%);
border-color: darken($colorBorde, 12%);
}
&:active,
&.active,
.open > &.dropdown-toggle {
background-image: none;
}
&.disabled,
&[disabled],
fieldset[disabled] & {
&,
&:hover,
&:focus,
&.focus,
&:active,
&.active {
border-color: lighten($colorBorde, 15);
}
}
}
@mixin pill($colorTexto, $colorBorde, $colorBG){
color: $colorTexto;
background-color: $colorBG;
border-color: $colorBorde;
&:hover,
&:focus,
&.focus,
&:active,
&.active,
.open > &.dropdown-toggle {
color: $colorTexto;
background-color: darken($colorBG, 10%);
border-color: darken($colorBorde, 12%);
}
&:active,
&.active,
.open > &.dropdown-toggle {
background-image: none;
}
&.disabled,
&[disabled],
fieldset[disabled] & {
&,
&:hover,
&:focus,
&.focus,
&:active,
&.active {
background-color: $colorBG;
border-color: $colorBorde;
}
}
}
.btn-loco {
@include miBoton(lineal, red, blue);
}
.btn-pill {
@include miBoton(pill, red, blue, orange);
}
.btn-loco {
color: red;
border-color: blue;
}
.btn-loco:hover, .btn-loco:focus, .btn-loco.focus, .btn-loco:active, .btn-loco.active, .open > .btn-loco.dropdown-toggle {
color: #cc0000;
border-color: #0000c2;
}
.btn-loco:active, .btn-loco.active, .open > .btn-loco.dropdown-toggle {
background-image: none;
}
.btn-loco.disabled, .btn-loco.disabled:hover, .btn-loco.disabled:focus, .btn-loco.disabled.focus, .btn-loco.disabled:active, .btn-loco.disabled.active, .btn-loco[disabled], .btn-loco[disabled]:hover, .btn-loco[disabled]:focus, .btn-loco[disabled].focus, .btn-loco[disabled]:active, .btn-loco[disabled].active, fieldset[disabled] .btn-loco, fieldset[disabled] .btn-loco:hover, fieldset[disabled] .btn-loco:focus, fieldset[disabled] .btn-loco.focus, fieldset[disabled] .btn-loco:active, fieldset[disabled] .btn-loco.active {
border-color: #4d4dff;
}
.btn-pill {
color: red;
background-color: orange;
border-color: blue;
}
.btn-pill:hover, .btn-pill:focus, .btn-pill.focus, .btn-pill:active, .btn-pill.active, .open > .btn-pill.dropdown-toggle {
color: red;
background-color: #cc8400;
border-color: #0000c2;
}
.btn-pill:active, .btn-pill.active, .open > .btn-pill.dropdown-toggle {
background-image: none;
}
.btn-pill.disabled, .btn-pill.disabled:hover, .btn-pill.disabled:focus, .btn-pill.disabled.focus, .btn-pill.disabled:active, .btn-pill.disabled.active, .btn-pill[disabled], .btn-pill[disabled]:hover, .btn-pill[disabled]:focus, .btn-pill[disabled].focus, .btn-pill[disabled]:active, .btn-pill[disabled].active, fieldset[disabled] .btn-pill, fieldset[disabled] .btn-pill:hover, fieldset[disabled] .btn-pill:focus, fieldset[disabled] .btn-pill.focus, fieldset[disabled] .btn-pill:active, fieldset[disabled] .btn-pill.active {
background-color: orange;
border-color: blue;
}
<a href="#" class="btn-loco">Hola</a>
<a href="#" class="btn-pill">Hola</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment