1. Single row overflow 1. If a single line overflows, the excess part will be displayed...or intercepted. The premise must be width. width:300px; overflow: hidden; text-overflow:ellipsis; whitewhite-space: nowrap; The effect is as shown below: 2. Multi-line overflow {display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:2;-webkit-box-orient:vertical;} display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; The effect is as shown below: Since WebKit's CSS extended properties are used, this method is applicable to WebKit browsers and mobile devices; Implementation method: p{position: relative; line-height: 20px; max-height: 40px; overflow: hidden;} p::after{content: "..."; position: absolute; bottombottom: 0; rightright: 0; padding-left: 40px; background: -webkit-linear-gradient(left, transparent, #fff 55%); background: -o-linear-gradient(rightright, transparent, #fff 55%); background: -moz-linear-gradient(rightright, transparent, #fff 55%); background: linear-gradient(to rightright, transparent, #fff 55%); } Scope of application: Note: 1. Set the height to an integer multiple of the line-height to prevent the text that exceeds the height from being exposed. 123WORDPRESS.COM editor adds: IE-based browsers must define line-height and height, and -webkit-line-clamp means a few lines, for example
-webkit-line-clamp -webkit-line-clamp is an unsupported WebKit property that does not appear in the CSS draft specification. |
<<: CSS scroll-snap scroll event stop and element position detection implementation
>>: HTML Marquee character fragment scrolling
1. Overflow content overflow settings (set whether...
Introduction to kubectl kubectl is a command line...
1. Warm and gentle Related address: http://www.web...
This article uses examples to describe MySQL dupl...
background Ever wondered how to create a shadow e...
Detailed explanation of mysql count The count fun...
This article shares with you two methods of setti...
Table of contents 1. Retrieve via --skip-grant-ta...
When there are tens of thousands of records in th...
First, build the case demonstration table for thi...
This article uses examples to illustrate the impa...
The web color picker function in this example use...
1. First go to the official website https://www.p...
How to host two or more sites on the popular and ...
A common suggestion is to create indexes for WHER...