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.
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
- Add the CSS to an HTML embed or to your pages custom code head section.
- 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>