Book Image

Sass and Compass Designer's Cookbook

By : Bass Jobsen, Stuart Robson
Book Image

Sass and Compass Designer's Cookbook

By: Bass Jobsen, Stuart Robson

Overview of this book

Sass and Compass Designer's Cookbook helps you to get most out of CSS3 and harness its benefits to create engaging and receptive applications. This book will help you develop faster and reduce the maintenance time for your web development projects by using Sass and Compass. You will learn how to use with CSS frameworks such as Bootstrap and Foundation and understand how to use other libraries of pre-built mixins. You will also learn setting up a development environment with Gulp. This book guides you through all the concepts and gives you practical examples for full understanding.
Table of Contents (23 chapters)
Sass and Compass Designer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. Create a new Compass project by running the following command in your console:

     compass create
    
  2. 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:...