CSS Properties White-space
<p style= "width:300px; Overflow:hidden; White-space:nowrap; text-overflow:ellipsis; " > Omit me, omit me, omit me, omit me, omit me, omit me, omit me, omit me, omit me </p>
Test Explorer: IE6/7/8/9, opera12.02, firefox15.0.1, chrome21.0.1180.89 m
1, text-overflow:ellipsis;
The main style here is text-overflow:ellipsis;
However, Text-ellipsis is a special style, the explanation is this: the Text-overflow property is only annotations, and if the text overflows, the ellipsis is displayed. No other style attribute definitions are available. The effect of an ellipsis on overflow must also be defined: Force the text to appear on one line (white-space:nowrap) and overflow content as hidden (Overflow:hidden), only in order to achieve the effect of overflow text display ellipsis.
This needs to limit the width, the text is displayed on one line (white-space:nowrap;), and the hidden attribute overflow is used.
Online to support the lower version of opera one way is to-o-text-overflow:ellipsis;
2.white-space Property
Normal default. The blank will be ignored by the browser.
The pre blank is reserved by the browser. It behaves like a <pre> tag in HTML.
The nowrap text does not wrap, and the text continues on the same line until the <br> tag is encountered.
Pre-wrap preserves a sequence of whitespace characters, but wraps normally.
Pre-line merges a sequence of whitespace characters, but preserves newline characters.
Inherit specifies that the value of the White-space property should be inherited from the parent element.
Object.style.whitespace=normal|nowrap|pre
3.word-wrap
1. (IE) consecutive English characters and Arabic numerals, using Word-wrap:break-word; or word-break:break-all; implement force break
2. (Firefox browser) consecutive lines of English characters and Arabic numerals, all versions of Firefox do not solve this problem, we only let the characters beyond the boundary hide or add a scrollbar to the container
. a{word-break:break-all; width:200px; overflow:auto;}
. (Firefox browser) use table-layout:fixed, force table width, inner layer td,th adopt word-break:break-all; or Word-wrap:break-word; newline, use overflow : Hidden; Hide beyond content, here Overflow:auto; not working
CSS adds ellipsis attributes beyond one line: Text-overflow and White-space