Home>Article>Web Front-end> How to set a line of words to be displayed and hidden in css

How to set a line of words to be displayed and hidden in css

青灯夜游
青灯夜游 Original
2021-01-19 16:02:31 3360browse

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.

How to set a line of words to be displayed and hidden in css

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:

How to set a line of words to be displayed and hidden in css

##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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn