Skip to content

Instantly share code, notes, and snippets.

@JoeNoPhoto
JoeNoPhoto / linearGradientMixin.sass
Created October 18, 2015 19:37
Linear Gradient Mixin
@mixin linearGradient($top, $bottom){
background: $top; /* Old browsers */
background: -moz-linear-gradient(top, $top 0%, $bottom 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$top), color-stop(100%,$bottom)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, $top 0%,$bottom 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, $top 0%,$bottom 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, $top 0%,$bottom 100%); /* IE10+ */
background: linear-gradient(to bottom, $top 0%,$bottom 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}
@JoeNoPhoto
JoeNoPhoto / retinaImages.sass
Created October 18, 2015 19:33
Retina Image Mixin
@mixin image-2x($image, $width, $height) {
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url($image);
background-size: $width + px $height + px;
background-size: $width / 10 + rem $height / 10 + rem;
}
@JoeNoPhoto
JoeNoPhoto / opactiy.sass
Created October 18, 2015 19:31
Opacity Mixin
@mixin opacity($opacity) {
opacity: $opacity;
$opacity-ie: $opacity * 100;
filter: alpha(opacity=$opacity-ie); //IE8
}
// Usage
.image{
@include opacity(.8);
}
@JoeNoPhoto
JoeNoPhoto / roundedCorners.sass
Created October 18, 2015 19:16
RoundedCorner Mixin
@mixin roundedCorners($size){
-webkit-border-radius: $size + px;
-moz-border-radius: $size + px;
border-radius: $size + px;
}
// Usage:
.button{
@include roundedCorners(10);
@JoeNoPhoto
JoeNoPhoto / colorStack.scss
Created October 18, 2015 19:06
Color Stack Mixin
$color-stack:
(group: orange, id: normal, color: #e67835),
(group: orange, id: pale, color: #f8a878),
(group: orange, id: dark, color: #ad490c),
(group: blue, id: normal, color: #426682);
// Color Function
@function color($group, $shade:normal, $transparency:1){
@each $color in $color-stack{
$c-group: map-get($color, group);
@JoeNoPhoto
JoeNoPhoto / fontStack.sass
Created October 18, 2015 18:53
FontStack Mixin
$font-stack:
(group: brandon, id: light, font: ('Brandon Grot W01 Light', san-serif ), weight: 200, style: normal),
(group: brandon, id: light-italic, font: ('Brandon Grot W01 Light', san-serif ), weight: 200, style: italic),
(group: brandon, id: regular, font: ('Brandon Grot W01-Regular', san-serif), weight: 400, style: normal),
(group: brandon, id: regular-italic, font: ('Brandon Grot W01-Regular', san-serif), weight: 400, style: italic),
(group: brandon, id: bold, font: ('Brandon Grot W01 Black', san-serif), weight: 700, style: normal),
(group: brandon, id: bold-italic, font: ('Brandon Grot W01-Regular', san-serif), weight: 400, style: italic),
(group: clarendon, id: regular, font: ('Clarendon LT W01', serif), weight: 200, style: normal),
(group: code, id: regular, font: (monospace), weight: 400, style: normal);
@JoeNoPhoto
JoeNoPhoto / mediaQueryStack.sass
Last active October 18, 2015 19:10
Media Query Stack
$media-stack:
(group: tablet, id: general, rule: "only screen and (min-device-width: 700px)"),
(group: small, id: general, rule: "only screen and(min-device-width: 1100px)"),
(group: small, id: inbetween, rule: "only screen and(min-device-width: 1100px) and (max-device-width: 1400px)"),
(group: large, id: general, rule: "only screen and(min-device-width: 1400px)"),
(group: print, id: general, rule: "only print"),
(group: custom, id: screen, rule: "only screen and");
@mixin media($group, $id: general, $customRule: ""){
@each $media in $media-stack{
@JoeNoPhoto
JoeNoPhoto / centeredTextFullBG.sass
Last active October 18, 2015 19:23
Vertically Centered Text on a Full Sized BG Image
@mixin image-spacer($ar: 1.00, $max-height: 600px, $min-height: 0, $container-width: 1.00) {
@if $min-height <= 1.00 and $min-height > 0 {
$container-width: $min-height;
$min-height: 0;
}
&:before {
content: '';
display: inline-block;
@JoeNoPhoto
JoeNoPhoto / hideElementMixin.scss
Created October 14, 2015 07:15
Hide Element Mixin
%visuallyhidden {
margin: -1px;
padding: 0;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
clip: rect(0, 0, 0, 0);
position: absolute;
}
@JoeNoPhoto
JoeNoPhoto / crossBrowserOpacity.scss
Created October 14, 2015 07:14
Cross Browser Opacity
@mixin opacity($opacity) {
opacity: $opacity;
$opacity-ie: $opacity * 100;
filter: alpha(opacity=$opacity-ie); //IE8
}