Last active
August 29, 2015 14:09
-
-
Save rpbaltazar/069bc1a1e81ebe9b8eb7 to your computer and use it in GitHub Desktop.
Multiline text wrapping using css (webkit only)
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
#parent-element { | |
/* Breaking this into main wrapper and truncate | |
allows you to have content that you actually | |
truncate and some other that you don't */ | |
.main-wrapper { | |
height: 160px; | |
} | |
.truncate { | |
p { | |
display: -webkit-box; | |
-webkit-line-clamp: 3; | |
-webkit-box-orient: vertical; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
max-width: 100px; /*the max-width can be inehrited from other elements, not being necessary to be here*/ | |
} | |
} | |
} | |
#parent-element | |
.main-wrapper | |
.some-nice-class | |
%p | |
%span this is some text | |
%span some more text that we need to show | |
.truncate | |
%p and this is the text that we want to truncate with multiple lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment