Skip to content

Instantly share code, notes, and snippets.

@cdharrison
Created July 30, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdharrison/6116394 to your computer and use it in GitHub Desktop.
Save cdharrison/6116394 to your computer and use it in GitHub Desktop.
My base mixins
// Mixins
@mixin clearfix-overflow{
overflow: hidden;
_overflow: visible;
zoom: 1;
}
@mixin boxEmboss($opacity, $opacity2){
box-shadow:white($opacity) 0 1px 0, inset black($opacity2) 0 1px 0;
}
// USAGE: .box{ @include boxEmboss(0.8, 0.05); }
@mixin letterpress($opacity){
text-shadow:white($opacity) 0 1px 0;
}
// http://nicolasgallagher.com/another-css-image-replacement-technique/
@mixin hideText{
font: 0/0 a;
text-shadow: none;
color: transparent;
}
@mixin navigation-list {
list-style-type: none;
padding: 0;
margin: 0;
overflow: hidden;
> li{
display: block;
float: left;
&:last-child{
margin-right: 0;
}
}
}
@mixin border-radius($topleft:5px,$topright:null,$bottomright:null,$bottomleft:null) {
@if $topright != null and $bottomright != null and $bottomleft != null {
border-top-left-radius: $topleft;
border-top-right-radius: $topright;
border-bottom-right-radius: $bottomright;
border-bottom-left-radius: $bottomleft;
-moz-border-radius-topleft: $topleft;
-moz-border-radius-topright: $topright;
-moz-border-radius-bottomright: $bottomright;
-moz-border-radius-bottomleft: $bottomleft;
-webkit-border-top-left-radius: $topleft;
-webkit-border-top-right-radius: $topright;
-webkit-border-bottom-right-radius: $bottomright;
-webkit-border-bottom-left-radius: $bottomleft;
} @else {
-webkit-border-radius:$topleft;
-moz-border-radius:$topleft;
border-radius:$topleft;
}
}
@mixin box-shadow($first, $second:null) {
@if $second != null {
-webkit-box-shadow:$first,$second;
-moz-box-shadow:$first,$second;
box-shadow:$first,$second;
} @else {
-webkit-box-shadow:$first;
-moz-box-shadow:$first;
box-shadow:$first;
}
}
@mixin transition($property,$delay:.2s,$easing:linear) {
-webkit-transition:$property $delay $easing;
-moz-transition:$property $delay $easing;
-o-transition:$property $delay $easing;
-ms-transition:$property $delay $easing;
transition:$property $delay $easing;
}
@mixin background-gradient($top_color:#fff,$bottom_color:#e6e6e6) {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from($top_color), color-stop(25%, $top_color), to($bottom_color));
background-image: -webkit-linear-gradient($top_color, $top_color 25%, $bottom_color);
background-image: -moz-linear-gradient(top, $top_color, $top_color 25%, $bottom_color);
background-image: -ms-linear-gradient($top_color, $top_color 25%, $bottom_color);
background-image: -o-linear-gradient($top_color, $top_color 25%, $bottom_color);
background-image: linear-gradient($top_color, $top_color 25%, $bottom_color);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$top_color}', endColorstr='#{$bottom_color}', GradientType=0);
}
@mixin vendor-prefix($name, $argument) {
-webkit-#{$name}: $argument;
-ms-#{$name}: $argument;
-moz-#{$name}: $argument;
-o-#{$name}: $argument;
#{$name}: $argument;
}
@mixin border-radius($argument) {
@include vendor-prefix(border-radius, $argument);
}
@mixin box-shadow($argument) {
@include vendor-prefix(box-shadow, $argument);
}
@mixin opacity($int) {
filter: alpha(opacity=$int);
-moz-opacity:$int/100;
opacity:$int/100;
}
@mixin input-placeholder-color($color) {
&::-webkit-input-placeholder { color: $color; }
&:-moz-placeholder { color: $color; }
&:-ms-input-placeholder { color: $color; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment