Gerillass
v2.1.0Type: Mixin
@include ellipsis();
* You can call mixins with or without the gls- namespace (e.g. @include gls-ellipsis();).
The Ellipsis Sass mixin helps you truncate text and add an ellipsis at the end of it, based on the given $width value.
Arguments
| Name | Type | Description |
|---|---|---|
$width (100%) | number <br/>(with unit) | The max-width of the selected element before its text is truncated. |
$display (inline-block) | string | Sets the display property of the selected elements. The default value is inline-block. |
Examples
Simply call the mixin inside an element's selector to truncate the text in it.
.element{
@include ellipsis;
}.element {
display: inline-block;
max-width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: normal;
}Result
Change the $width or $display values if you need to.
.element{
@include ellipsis(
$width: 200px,
$display: block
);
}.element {
display: block;
max-width: 200px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: normal;
}Result