Skip to content

Instantly share code, notes, and snippets.

@haze83
Created February 15, 2018 17:11
Show Gist options
  • Save haze83/c4a13083dbadff11274bb330bd5352cd to your computer and use it in GitHub Desktop.
Save haze83/c4a13083dbadff11274bb330bd5352cd to your computer and use it in GitHub Desktop.
convert indesign tracking value to the css letter-spacing equivalent
// convert indesign tracking value to css letter-spacing
@function tracking-to-letter-spacing($tracking: 0) {
@return $tracking / 1000 * 1em;
}
@mixin tracking-to-letter-spacing($tracking: 0) {
letter-spacing: tracking-to-letter-spacing($tracking);
}
// manually sample
.text-wide-manually {
letter-spacing: 40 / 1000 * 1em;
}
// function sample
.text-wide-function {
letter-spacing: tracking-to-letter-spacing(40);
}
// mixin sample
.text-wide-mixin {
@include tracking-to-letter-spacing(40);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment