This time I will introduce to you what are the precautions for using pure CSS3 to intercept strings. The following is a practical case, let's take a look.
Code examples are as follows:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.jb51.net/" /> <title>CSS</title> <style type="text/css"> #first{ width:120px; height:30px; background-color:#F30; overflow:hidden; text-overflow:clip; white-space:nowrap; } #second{ width:120px; height:30px; background-color:#F30; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:10px; } </style> </head> <body> <p id="first">QWEQWEQWEQWE</p> <p id="second">QWEQWEQWEQWE</p> </body> </html>
Special note: white-space:nowrap and overflow:hidden cannot be omitted, otherwise the intercepted string will be invalid.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Develop a small program to create a pop-up menu function (with code)
Upgrade webpack to version 4.0 And install webpack-cli
The above is the detailed content of Intercept string using pure CSS3. For more information, please follow other related articles on the PHP Chinese website!