-
-
Save justerror/e25ceb7eccf9089393f6cf568569cdd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clamps a block of text to a certain number of lines, | |
// followed by an ellipsis in Webkit and Blink based browsers | |
// Reference: http://dropshado.ws/post/1015351370/webkit-line-clamp | |
@mixin text-clamp($lines: 2, $line-height: false) { | |
overflow: hidden; | |
display: -webkit-box; | |
-webkit-box-orient: vertical; | |
-webkit-line-clamp: $lines; | |
// Fallback for non-Webkit browsers | |
// (won't show `…` at the end of the block) | |
@if $line-height { | |
max-height: $line-height * $lines * 1px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment