Skip to content

Instantly share code, notes, and snippets.

@dieppon
dieppon / RGBA-IE-backgroound.scss
Created February 27, 2014 10:30
Create cross-browsing alpha transparent backgrounds.
// RGBa background
@mixin background-rgba($color, $alpha) {
$rgba: rgba($color, $alpha);
$ie-hex-str: ie-hex-str($rgba);
// Fallback for web browsers that doesn't support RGBa
background-color: $color;
// Reset background to transparent only in IE 6-8 using the backslash 9 hack http://webdood.com/?p=57
background-color: transparent\9;
// RGBa with $alpha opacity
background-color: $rgba;
@dieppon
dieppon / scss-placeholder.scss
Last active August 29, 2015 13:56
Style HTML5 placeholders with this mixin.
// Placeholder
@mixin placeholder {
&:-moz-placeholder { @content; }
&::-moz-placeholder { @content; }
&:-ms-input-placeholder{ @content; }
&::-webkit-input-placeholder { @content; }
}
@dieppon
dieppon / vertical-grid-compass-mixin.scss
Last active August 29, 2015 13:56
Debug the vertical rhythm in your site by adding a grid overlay. It's been design to be use with compass and it uses Basehold.it(http://basehold.it/), the quick, painless, javascript-free baseline overlay.
@mixin vertical-grid($color:null, $alpha:null, $base-line-height:$base-line-height){
// Remove unit
$base-line-height: $base-line-height / ($base-line-height * 0 + 1);
//Extract chanels
$get-red: red($color);
$get-green: green($color);
$get-blue: blue($color);
@mixin svg-graphic($imgfilename, $imgtype, $imgwidth, $imgheight) {
background-image: url('../img/' + $imgfilename + '.' + $imgtype);
background-image: url('../img/' + $imgfilename + '.svg'), none;
background-size: $imgwidth $imgheight;
}
@dieppon
dieppon / font-smoothing-mixin.scss
Created April 10, 2014 11:32
James Wilson's (https://gist.github.com/jameswilson) mixing for the 'font-smoothing' CSS rule
@mixin font-smoothing($value: antialiased) {
@if $value == antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@else {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
}
}
@dieppon
dieppon / ie-height.scss
Created April 10, 2014 14:43
Cross-browsing min/max heights
@mixin min-height($value){
height: auto !important;
height: $value;
min-height: $value;
}
@mixin max-height($value){
height: auto !important;
height: $value;
max-height: $value;
@dieppon
dieppon / _social-colours.scss
Last active August 29, 2015 14:01
Social Network Colours
$color-blogger: #FF8833;
$color-facebook: #3B5998;
$color-flickr: #FE0883;
$color-foursquare: #0072B1;
$color-google-plus: #C63D2D;
$color-instagram: #4E433C;
$color-linkedin: #4875B4;
$color-pinterest: #910101;
$color-reddit: #CEE3F8;
$color-rss: #FA9B39;
@dieppon
dieppon / hires-graphic-mixin.scss
Last active August 29, 2015 14:01
Adds support for @2x background images for retina displays.
// higher resolution images for high resolution displays
@mixin hires-graphic($hdfile, $hdtype, $hdwidth, $hdheight) {
$filename: $hdfile + '.' + $hdtype;
$hdfilename: $hdfile + '@2x.' + $hdtype;
background-image: url('../images/' + $filename);
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
background-image: url('../images/' + $hdfilename) !important;
-webkit-background-size: $hdwidth $hdheight;
background-size: $hdwidth $hdheight;
}
// Sprite graphic for easy reuse
@mixin sprite-graphic($sprite-graphic-pos:null, $format: $sprite-graphic-format, $file: $sprite-graphic-file, $type: $sprite-graphic-type, $width: $sprite-graphic-width, $height: $sprite-graphic-height){
@if $format == 'hires' {
@include hires-graphic($file, $type, $width, $height);
}
@if $format == 'svg' {
@include svg-graphic($file, $type, $width, $height);
}
@if $sprite-graphic-pos == 'null' {}
@else {
@dieppon
dieppon / _even-number-validator.scss
Created June 17, 2014 14:14
SASS even number validator
@function even($number) {
@return $number % 2 == 0;
}