Skip to content

Instantly share code, notes, and snippets.

@sebastiano-guerriero
Created October 5, 2018 14:32
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sebastiano-guerriero/f4705dd81330a67d0623fc459b00b24d to your computer and use it in GitHub Desktop.
Save sebastiano-guerriero/f4705dd81330a67d0623fc459b00b24d to your computer and use it in GitHub Desktop.
// clearfix
@mixin clearfix {
&::after {
content: "";
display: block;
clear: both;
}
}
// edit font rendering -> tip: use for light text on dark backgrounds
@mixin fontSmooth {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// crop top space on text elements - caused by line height
@mixin lhCrop($line-height, $capital-letter: 1) {
&::before {
content: '';
display: block;
height: 0;
width: 0;
margin-top: calc((#{$capital-letter} - #{$line-height}) * 0.5em);
}
}
// CSS triangle
@mixin triangle ($direction: up, $width: 12px, $color: red) {
width: 0;
height: 0;
border: $width solid transparent;
@if( $direction == left ) {
border-right-color: $color;
} @else if( $direction == right ) {
border-left-color: $color;
} @else if( $direction == down ) {
border-top-color: $color;
} @else {
border-bottom-color: $color;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment