twbs / twbs/bootstrap

Add multi-line text truncation utilities

Open
#42,889 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css feature
Dominant language
MDX
Stars
175k
Forks
78.6k
Avg merge
7h 19m
Merged PRs (30d)
35

Description

Prerequisites
Proposal

Bootstrap currently provides the .text-truncate utility for truncating text to a single line.

It would be useful to provide an optional utility for truncating text after multiple lines.

For example:

This is a long paragraph that should be truncated after two lines while preserving the responsive layout.

the css can be like .text-truncate-lines-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
Motivation and context

Multi-line text truncation is commonly needed in cards, product descriptions,
article previews, and responsive layouts.

Currently, developers need to write custom CSS for this behavior. A Bootstrap
utility could provide a consistent and reusable solution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating Bootstrap’s existing .text-truncate utility and review how utilities are documented and tested. Define a consistent multi-line truncation utility based on the proposed example, then verify that it truncates at the requested line count while preserving responsive layout behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.