Skip to content

Instantly share code, notes, and snippets.

@DominikStyp
Created November 8, 2021 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DominikStyp/ca106bd754f7822809b8b34d8355815f to your computer and use it in GitHub Desktop.
Save DominikStyp/ca106bd754f7822809b8b34d8355815f to your computer and use it in GitHub Desktop.
SCSS mixin: Line Clamp for multiple lines (dots for text oferflow)
// https://caniuse.com/?search=line-clamp - way around line-clamp needed
@mixin ellipsis-for-lines($max-lines: 3) {
/* stylelint-disable */
display: -moz-box;
display: -webkit-box;
text-overflow: ellipsis;
-webkit-line-clamp: $max-lines;
-webkit-box-orient: vertical;
-moz-line-clamp: $max-lines;
-moz-box-orient: vertical;
/* stylelint-enable */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment