Code

Single Line Truncate Text

Automatically truncate text that goes beyond a line on your Webflow site with this simple CSS script. This helps create uniformed design on your site by truncating text with ellipsis if they go beyond a single line.

Single Line Truncate Text preview

Automatically truncate text that goes beyond a line on your Webflow site with this simple CSS script. This helps create uniformed design on your site by truncating text with ellipsis if they go beyond a single line.

How to add it

  1. Add the CSS to an HTML embed or to your pages custom code head section.
  2. Utilize .truncate class on any text that you want to have truncated at a single line

The code

CSS
                      <!-- Add via an HTML embed or to your head section -->
<style>
.truncate {
  width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>

                    

Browse similar code snippets

Language

More from Corey Moen

Profile →

Related Webflow questions

All answers →

Similar code snippets

All code snippets →