Skip to content

Instantly share code, notes, and snippets.

View imlinus's full-sized avatar

Linus imlinus

  • bitwise
  • Sweden
  • 18:30 (UTC +02:00)
View GitHub Profile
@imlinus
imlinus / font-smoothing.scss
Last active December 26, 2015 18:59
Font-smoothing mixin
@mixin font-smoothing($val: antialiased) {
@include prefix(font-smoothing, $val);
}
// usage
* {
@include font-smoothing(antialiased);
}
@imlinus
imlinus / font-face.scss
Created October 28, 2013 15:21
font-face mixin (with IE8 support)
// Mixin for custom webfonts with IE8 fallback
@mixin font-face(
$name,
$font-files,
$eot: false,
$weight: normal,
$style: normal
) {
$iefont: unquote("#{$eot}?#iefix");
@imlinus
imlinus / ir.scss
Last active December 26, 2015 19:08
ir (hide-text) mixin/placeholder
@mixin ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
%ir {
@include ir;
@imlinus
imlinus / retina.scss
Created November 22, 2013 12:16
Retina mixin
$isRetina: "(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-device-pixel-ratio: 1.5)";
@mixin retina {
@media #{$isRetina} { @content; }
}
// usage
.logotype {
width: 100px;
@imlinus
imlinus / position.scss
Last active December 29, 2015 02:18
position mixin
@mixin position(
$position: absolute,
$top: null,
$right: null,
$bottom: null,
$left: null
) {
position: $position;
top: $top;
right: $right;
@imlinus
imlinus / inline-block.scss
Created November 22, 2013 12:23
inline-block mixin/placeholder
@mixin inl-block {
display: -moz-inline-stack;
display: inline-block;
vertical-align: middle;
*vertical-align: auto;
zoom: 1;
*display: inline;
}
%inline-block {
@imlinus
imlinus / user-select.scss
Last active December 29, 2015 02:18
user-select mixin/placeholder
// attributes: none | text | all | element
// Only call for mixin within media querys, otherwise use placeholder!
@mixin user-select($val: none) {
-webkit-touch-callout: $val;
@include prefix(user-select, $val);
}
%user-select-none { @include user-select(none); }
%user-select-text { @include user-select(text); }
@imlinus
imlinus / clearfix.scss
Last active December 29, 2015 02:19
Clearfix mixin/placeholder
@mixin clearfix {
*zoom: 1;
&:before,
&:after {
content: "";
display: table;
}
&:after { clear: both; }
@imlinus
imlinus / ellipsis.scss
Last active December 29, 2015 02:19
ellipsis mixin/placeholder
// Mixin for creating a ellipsis (...) when text is too long.
// Only call the mixin within media querys, otherwise use the placeholder!
@mixin ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
%ellipsis {
@imlinus
imlinus / mediaquery.scss
Last active December 29, 2015 02:39
media query handler mixin
// Simple mixin when calling different viewports
// Remember - you can't extend within media-querys
//
// basic usage:
// @include respond(retina) {
// background-image: url('path/to/retina/image.png');
// background-size: 100px 50px;
// }
// Store these in your global.scss