Skip to content

Instantly share code, notes, and snippets.

@rankun203
Last active December 14, 2016 10:20
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 rankun203/8e3f5e32e327939bc23c1dcf948bd8f7 to your computer and use it in GitHub Desktop.
Save rankun203/8e3f5e32e327939bc23c1dcf948bd8f7 to your computer and use it in GitHub Desktop.
css-limit-lines.css
/* mixin for multiline */
@mixin multiLineEllipsis($lineHeight: 1.2em, $lineCount: 1, $bgColor: white){
overflow: hidden;
position: relative;
line-height: $lineHeight;
max-height: $lineHeight * $lineCount;
text-align: justify;
margin-right: -1em;
padding-right: 1em;
&:before {
content: '...';
position: absolute;
right: 0;
bottom: 0;
}
&:after {
content: '';
position: absolute;
right: 0;
width: 1em;
height: 1em;
margin-top: 0.2em;
background: $bgColor;
}
}
.entry-summary {
@include multiLineEllipsis($lineHeight: 1.7em, $lineCount: 2, $bgColor: white);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment