Multiline Text Overflow with Ellipsis
In CSS, the text-overflow property allows truncating text when it exceeds the designated area. However, by default, this truncation occurs on a single line. Sometimes, it is desirable to allow text to wrap on multiple lines while still indicating that there's more to be seen.
Achieving Multiline Overflow with Ellipsis
To achieve this effect, we can utilize the following CSS properties:
Example Usage
div { width: 300px; height: 42px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
With these properties in place, text within the
Note: These properties are only supported by WebKit-based browsers, including Chrome and Safari. Other browsers may require alternative solutions.
The above is the detailed content of How to Achieve Multiline Text Overflow with Ellipsis in CSS?. For more information, please follow other related articles on the PHP Chinese website!