In the P layout, some of the text content will exceed the overflow of our limit height, some pictures will burst Div, so that the page dislocation chaos. What should I do if the content overflows the container and exceeds the width and height that the container limits? can add
The text Overflow section is hidden or is replaced with an ellipsis, how to achieve it concretely? This article tells you how to use line breaks, ellipses, and so on to solve these overflow problems.
First, the use of line-wrapping to solve the overflow problem
1. How to use Word-wrap to solve the problem of text overflow
Word-break:break-all and Word-wrap:break-word are often used to solve long string wrapping problems. Word-break:break-all in Ie6/7/chrome/safari as a faction, showing the tail truncation, and Ff3.0/opera performance as invalid. Both the long word wrap display and the overflow boundary. Word-wrap:break-word in Ie6/7/chrome/safari for a long word for a line, and then show no more than cut. The Ff3.0/opera is also ineffective.
2. How to handle CSS overflow and line wrapping
text is too long to display in the container, whether you want to wrap, use White-space:normal/nowrap property, Normal: Browser default setting; NoWrap: No Line break.
After overflow processing, if you want to hide the overflow content, you can consider using the Text-overflow property.
3. Firefox/ie browser Flash transparent, CSS force does not wrap, overflow hidden
CSS Force no wrap, overflow hidden:overflow:hidden
Instructions and points for use:
Retrieves or sets how content is managed when the object's content exceeds its specified height and width.
Setting the TextArea object to a hidden value hides its scroll bar.
For table, if the Table-layout property is set to fixed, the TD object supports a overflow property with a default value of hidden. If set to Hidden,scroll or auto, then the content beyond the TD size will be clipped. If set to visible, causes additional text to overflow to the right or left (depending on the direction property setting) of the cell.
This property is available on the Mac platform from IE5 onwards. The corresponding script attribute is overflow.
Second, the use of ellipsis to solve the overflow problem
1. HTML text control display the number of words beyond the use of ellipsis method
The general use of P+CSS container text beyond the length will float to the outside of the box or box support, sometimes need to consider browser compatibility issues, different browsers for the CSS standard implementation is different. Because Firefox is recognized as a standard browser [of course, opera is also], and the market share is higher, so you can use Firefox for certification.
2. CSS, J ' s single line, multiline text overflow display ellipsis
In the project, because the actual description of the text too much, resulting in the initial page length is too long, the remaining information utilization is reduced; So when there is too much text, it is necessary to initialize the Limit line number, the CSS single line multiline text overflow, display the ellipsis.
3. Summary of methods for single-line and multiline text overflow with ellipsis display
In the front-end page layout, there will often be too much text to affect the page layout. Especially in mobile pages, because the screen width is not enough, paragraph text, such as full display, will disrupt the layout. Therefore, if the paragraph text can be displayed according to the size of the screen is perfect, that is, if the screen is large enough, paragraph text is fully displayed, if the screen is very small, the paragraph text in the form of ellipses to display.
4. Content overflow layout in table table
We know that when we enter too much text in the table, we make a mess of the table, for example, a line that is too long or wraps itself. But sometimes we want to show in a fixed-width line, if the extra part that is replaced with a dot dot, so that will not be messy table.
5. Use CSS to resolve the title display the number of words beyond the ellipsis substitution method
Step One: Hide content beyond the width
Step two: Show ellipsis (...) when text overflows inside an object
Questions and answers about CSS content overflow and shadowing
1. HTML-How to use JavaScript to determine if P has overflow?
2. CSS3-List Horizontal overflow displays ellipsis (ellipsis is a picture)
3. How do I get the height of the inner element after the overflow is hidden?
"Recommended"
1. php.cn Lonely Nine-base (2)-css video tutorial