Last active
February 1, 2023 08:44
-
-
Save paulmelero/99bb2637873b96a3073f to your computer and use it in GitHub Desktop.
Alternative to `-webkit-line-clamp` as a mixin.
This file contains 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
///* | |
//* Usage: | |
//* @include fake-clamping(1.2, 1); | |
//*/ | |
@mixin fake-clamping($line-height: 1.4, $lines: 1, $padding: 0, $w: false) { | |
$_height: $line-height * $lines + $padding; | |
height: #{$_height}em; | |
overflow: hidden; | |
white-space: nowrap; | |
word-wrap: normal; | |
text-overflow: ellipsis; | |
@if $w { | |
max-width: #{$w}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment