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.
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.