Skip to content

Instantly share code, notes, and snippets.

@adewalegeorge
Forked from bivald/photoshop-to-css.sass
Last active August 29, 2015 14:25
Show Gist options
  • Save adewalegeorge/21f395955e81570d13d5 to your computer and use it in GitHub Desktop.
Save adewalegeorge/21f395955e81570d13d5 to your computer and use it in GitHub Desktop.
/* Reset rem to 10-based instead of default browser 16 */
html {
font-size: 62.5%;
}
/*
Photoshop does not apply line height to the first row, which CSS does. This creates all kinds of havock.
To calculate the correct offset for the first line we need the font-size and the lineheight, i.e:
@include line-height(22,30);
in Photoshop points/px (but with no unit)
*/
@mixin line-height($fontsize, $lineheight ){
line-height: ($lineheight) + px;
line-height: ($lineheight/10) + rem;
margin-top: (($lineheight - $fontsize)/2 * -1) + px;
margin-top: ((($lineheight - $fontsize)/2 * -1) / 10 ) + rem
}
/* Letter spacing is simpler.. stolen from somewhere */
@mixin letter-spacing($letterspacing) {
letter-spacing: $letterspacing/1000;
}
/* font-size to rem with backup, stolen from somewhere */
@mixin font-size($sizeValue: 16) {
font-size: ($sizeValue) + px;
font-size: ($sizeValue/10) + rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment