Skip to content

Instantly share code, notes, and snippets.

@equinusocio
Created February 14, 2017 10:56
Show Gist options
  • Save equinusocio/196b873efddba6ce2357d5cc5f8217e3 to your computer and use it in GitHub Desktop.
Save equinusocio/196b873efddba6ce2357d5cc5f8217e3 to your computer and use it in GitHub Desktop.
CSS Multiline Truncate
$font-size: 26px;
$line-height: 1.4;
$lines-to-show: 3;
h2 {
display: block; /* Fallback for non-webkit */
display: -webkit-box;
max-width: 400px;
height: $font-size * $line-height * $lines-to-show; /* Fallback for non-webkit */
margin: 0 auto;
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