Skip to content

Instantly share code, notes, and snippets.

@davidrleonard
Created February 16, 2019 01:35
Show Gist options
  • Save davidrleonard/510735306d3c4cdf4543d0a895b4f337 to your computer and use it in GitHub Desktop.
Save davidrleonard/510735306d3c4cdf4543d0a895b4f337 to your computer and use it in GitHub Desktop.
@mixin eds-mx-text-crop($desired-line-height: $eds-global-line-height) {
$ratio: $desired-line-height / $eds-global-line-height;
&:before,
&:after {
content: '';
display: block;
width: 0;
height: 0;
}
&:before {
margin-bottom: calc(#{var(--eds-global-text-crop-top, -0.3125em)} * #{$ratio});
}
&:after {
margin-top: calc(#{var(--eds-global-text-crop-bottom, -0.25em)} * #{$ratio});
}
}
.eds-text-crop {
@include eds-mx-text-crop();
}
.random-thing-with-different-line-height {
line-height: 12;
@include eds-mx-text-crop(12);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment