Home >Web Front-end >Front-end Q&A >What is used to set text height in css3
In CSS3, you can use the height attribute together with the overflow attribute to set the text height; the height attribute is used to set the height of the element, and the overflow attribute is used to set the text to be hidden beyond the height of the element. The syntax is "text element {height: The height value that needs to be displayed;overflow:hidden;}".
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
We can set the display height of the text element through the height attribute, and set the display and hide when the text element exceeds the height through the overflow attribute.
The overflow attribute specifies what happens when content overflows the element box. When the element value is set to hidden, the excess part will be hidden.
Examples are as follows:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> div{ width:200px; height:100px; border:1px solid black; overflow:hidden; } </style> </head> <body> <div>css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏css设置文本显示高度超出部分隐藏</div> </body> </html>
Output results:
(Learning video sharing: css video tutorial,html video tutorial)
The above is the detailed content of What is used to set text height in css3. For more information, please follow other related articles on the PHP Chinese website!