<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "Utf-8"> <title></title> <styletype= "Text/css">DL{width:240px;Border:Solid 1px #ccc; }DT{padding:8px 8px;background:#7fecad;font-size:13px;text-align: Left;Font-weight:Bold;Color:#71790c;Margin-bottom:12px;Border-bottom:Solid 1px #efefef; }DD{font-size:0.78em;Height:1.5em;width:220px;padding:2px 2px 2px 18px;margin:2px 0;White-space:nowrap;Overflow:Hidden;Text-overflow:ellipsis; } </style> </Head> <Body> <DL> <DT>Sports News</DT> <DD>Asian Games opens in South Korean port city of Incheon, South Korean President Park Geun-hye attends</DD> <DD>On the first day of the Asian Games, the Korean Legion topped the medal table</DD> <DD>Asian Games Swimming Spectator guide: 21st began Sun Pan 5 showdown between the big PK</DD> <DD>Asian Games opens in South Korean port city of Incheon, South Korean President Park Geun-hye attends</DD> <DD>On the first day of the Asian Games, the Korean Legion topped the medal table</DD> <DD>Asian Games Swimming Spectator guide: 21st began Sun Pan 5 showdown between the big PK</DD> </DL> </Body></HTML>
In CSS3, the basic syntax for the Text-overflow property is as follows:
- Clip: Indicates that the omitted text is not displayed and is simply trimmed.
- Ellipsis: Indicates that an ellipsis is displayed when an object text overflows, and the caret insertion position is the last character.
- Ellipsis-word: Indicates that an ellipsis is displayed when the object text overflows, and the position of the ellipsis insertion is the last word (word).
In fact, the Text-overflow property is used only to determine if an ellipsis is displayed when text overflows, does not have a style-defined function, and to produce an ellipsis effect when overflow, you should define two styles: force the text to appear on one line (white-space: nowrap) and overflow content as hidden (Overflow:hidden), only in this way can the overflow text be displayed as an ellipsis effect.
CSS overflow text ellipsis (text-overflow)