Home > Article > Web Front-end > Example tutorial on limiting the display length of characters and adding ellipses
How to solve the problem that the number of words displayed in html text control exceeds the limit? That is, the text overflow control displays the number of words, and the table text overflow control td displays the number of words. When you see the title, you will easily think of the method of truncating the text and adding an ellipsis "...". Haha, that's it. In fact, writing this log is just to record this method, because it seems that many people still don’t remember how to deal with such a situation. The picture below is the display effect of php Chinese website (www.php.cn) when the number of words exceeds the number and ellipses are added. First, let me explain. Generally, if the text in a container using DIV+css exceeds the length, it will float outside the frame or expand the frame. This is generally It's easy to solve, but I encountered this problem today: the test page under IE6 did not respond, but the test page under IE8 processed the overflow text normally, and I was depressed. Isn't this overflow processing unique to IE? Why is IE6 not working properly? Later, I checked online and found out that it turns out that IE6 only supports overflow processing if it is written inside a DIV, and IE6 or above only supports writing it in
1. HTML text control display word count exceeds the method of using ellipses
Introduction: How to solve the problem that the number of words displayed in HTML text control exceeds the limit? That is, text overflow controls the number of words displayed, and table text overflow controls the number of words displayed in td. When you see the title, you will easily think of the method of truncating the text and adding an ellipsis "...".
2. Use css3 to truncate text and add ellipses
Introduction: Limit the number of lines of text displayed in a block element. In order to achieve this effect, it needs to be combined with other foreign WebKit properties.
Introduction: Example of adding ellipsis code after the intercepted string implemented in pure CSS
4. How does php limit the display length of characters?
Introduction: Like the above (interception from Tieba), when the character length exceeds the fixed pixel width, the string within the pixel width range is intercepted, and after the string Add an ellipsis. The mb_strlen function can only get the number of characters, but the width of a character in English and Chinese is different, and it cannot be determined based on the number of characters...
5. php String interception problem
#Introduction: I want to display a string with a limited length. If the string exceeds a certain length, intercept the first n characters and add an ellipsis after it.
6. php string interception problem_php skills
Introduction: I want to limit the length of a string Display, if the string exceeds a certain length, intercept the first n characters and add an ellipsis
[Related Q&A recommendations]:
javascript - How to add ellipses to the overflow part of multi-line text?
How to limit the display length of characters in php?
The above is the detailed content of Example tutorial on limiting the display length of characters and adding ellipses. For more information, please follow other related articles on the PHP Chinese website!