How can web pages be displayed with ellipses in the middle of super-long text on the mobile side?

the mobile page does not always display how many words are displayed because it needs to be adapted. If the text is too long, how to keep the head and tail and replace it with an ellipsis in the middle, and the total length is just enough to fill the width of the screen?

Apr.01,2021

single line

position: relative; line-height: 20px; max-height: 40px;overflow: hidden;}
p::after{content: "..."; position: absolute; bottom: 0; right: 0; padding-left: 40px;
background: -webkit-linear-gradient(left, transparent, -sharpfff 55%);
background: -o-linear-gradient(right, transparent, -sharpfff 55%);
background: -moz-linear-gradient(right, transparent, -sharpfff 55%);
background: linear-gradient(to right, transparent, -sharpfff 55%);
this method has a wide range of applications, but there will be ellipses when the text does not exceed the travel time. This method can be optimized with js.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47c30-44c51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47c30-44c51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?