Ajouter

Lorem ipsum

Lorem ipsum

Design

4 min

How to Truncate Text in Webflow Easily

Introduction

ApproachMethodBenefit
JavaScript (this tutorial)CSS class scriptPrecise control by character count
Native Webflow CSStext-overflow: ellipsisSimple, no code, truncates by line
CSS -webkit-line-clampVia CSS embedLimits to N lines without JS

In this tutorial, Sandro, cofounder of the Gemeos Webflow agency, shows you how to easily truncate text in Webflow.

Truncating text can be super useful for a few reasons, especially when you want to keep your Hub pages consistent, like blog pages, guides, articles, and more. It helps keep the layout consistent no matter how long your text is (see image below).

Example of truncated text in Webflow

Here’s how you can do the same in under 5 minutes

1. Add a class to the text you want to truncate

In my example, I use the class "slice"

Webflow CSS class example

2. Add this code to your project

You can add this code in an embed or directly in the body of your page

 

Make sure you replace "slice" with your CSS class

good to know

var elements = document.getElementsByClassName('slice');

3. Adjust the character length to the value you want

All you need to do is replace the 64 in the code above with your own value. It’s that simple!

good to know

For a 100% JavaScript-free solution, use overflow: hidden + text-overflow: ellipsis + white-space: nowrap (one line) or -webkit-line-clamp (multiple lines). More performant than JS.

4. Publish and you’re done!

That’s all there is to it 😎

Published on 10.04.2025

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...