Truncating Text with ellipses
In this recipe, you will learn how to truncate text with ellipses using Compass. The text-overflow
CSS property determines how overflowed content that is not displayed is signaled to users. It can be clipped; it can display an ellipsis or a custom string. The overflow()
mixin of Compass helps you write cross-browser CSS code for truncating texts with ellipses.
Getting ready
For this recipe, you will need a modern web browser. Of course, you also have to install Compass. The Installing Compass recipe of Chapter 1, Getting Started with Sass, describes how to install Compass on your system.
How to do it...
The following steps will show you how to truncate text with the Compass helper functions:
Create a new Compass project by running the following command in your console:
compass create
Then, create a new
sass/main.scss
file that will contain SCSS code like that shown here:@import "compass/typography/text/ellipsis"; .truncated { @include ellipsis(); width:...