Skip to content

Instantly share code, notes, and snippets.

@igorescobar
Last active September 6, 2016 15:52
Show Gist options
  • Save igorescobar/d74a76629bab47d601d71c3a6e010ff2 to your computer and use it in GitHub Desktop.
Save igorescobar/d74a76629bab47d601d71c3a6e010ff2 to your computer and use it in GitHub Desktop.
// e.g: @include truncate(.875em, 1.4, 10)
@mixin truncate($font-size, $line-height, $lines-to-show) {
display: block; // Fallback for non-webkit
display: -webkit-box;
max-width: 400px;
height: $font-size*$line-height*$lines-to-show; // Fallback for non-webkit
font-size: $font-size;
line-height: $line-height;
-webkit-line-clamp: $lines-to-show;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment