A Pen by Martin Wolf on CodePen.
Created
December 29, 2014 03:08
-
-
Save anonymous/d43d9ef7f448d5b0dfd9 to your computer and use it in GitHub Desktop.
Pure CSS multiline text with ellipsis
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
<h2>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et.</h2> |
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
@import "compass/css3"; | |
/* Martin Wolf CodePen Standard */ | |
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,700); | |
* { | |
margin: 0; | |
padding: 0; | |
@include box-sizing(border-box); | |
} | |
body { | |
padding: 3em 2em; | |
font-family: 'Open Sans', Arial, sans-serif; | |
color: #cf6824; | |
background: #f7f5eb; | |
} | |
/* END Martin Wolf CodePen Standard */ | |
$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