Home>Article>Web Front-end> How to set a line of words to be displayed and hidden in css
The overflow attribute can be used in css to set a line of text to be hidden if it cannot be displayed completely; just add the "overflow:hidden;" style to the text box element and set the text content to be trimmed when the content overflows the element box. , and the overflow part is not visible.
The operating environment of this tutorial: windows7 system, css3&&html5 version, Dell G3 computer.
(Learning video sharing:css video tutorial)
In css, it can be set through the "overflow:hidden;" style.
Code:
这一行很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的。
这一行很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的。
Rendering:
##Description: overflow attribute
overflow Properties specify what happens when content overflows the element's box. This attribute defines how content that overflows the element's content area will be handled. If the value is scroll, the user agent provides a scrolling mechanism whether required or not. Therefore, it is possible that scrollbars will appear even if everything fits inside the element box. When the value of the overflow attribute is set to "hidden", the content is trimmed and the remaining content is invisible. For more programming related knowledge, please visit:Programming Video! !
The above is the detailed content of How to set a line of words to be displayed and hidden in css. For more information, please follow other related articles on the PHP Chinese website!