Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the excess not to be displayed by html

Shulou Source: shulou.com Published: 2022-06-03 15:09:09 10月26日 Update

This article mainly introduces how to set the excess part of html not to show, it has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

Html sets the excess part of the method: 1, by setting "width:10em;" to ensure that the text will not be truncated by semi-Chinese characters; 2, by setting "overflow: hidden;" to hide the text beyond the length; 3, through "text-overflow:ellipsis;" to set ellipsis.

This article operating environment: windows7 system, HTML5&&CSS3 version, Dell G3 computer.

How does html set the excess part not to be displayed?

HTML settings beyond partial hiding

Title div {width: 10eme; / * ensure that the text will not be truncated by semi-Chinese characters, showing 10 characters * / overflow: hidden; / * text hiding beyond the length * / text-overflow:ellipsis;/* text hidden after adding an ellipsis * / white-space: nowrap / * forcing no line wrapping * /} text exceeds the need to hide and show ellipses, which is often used at work. I think many people have encountered it. There are two solutions to this: Title div {width: 10em; / * ensure that the text will not be truncated by semi-Chinese characters, showing 10 characters * / overflow: hidden / * the ellipsis appears * / text-overflow: ellipsis; / * in which line * /-webkit-line-clamp: 2; display:-webkit-box;-webkit-box-orient: vertical } text exceeds the need to hide and show ellipses, which is often used at work. I think many people have encountered it. There are two solutions to this: Title div {width: 10em; / * ensure that the text will not be truncated by semi-Chinese characters, showing 10 characters * / overflow: hidden / * text hiding beyond length * / text-overflow:ellipsis;/* text hiding followed by an ellipsis * / white-space: nowrap / * forcing no line wrapping * /} text exceeds the need to hide and show ellipses, which is often used at work. I think many people have encountered it. There are two solutions to thank you for reading this article carefully. I hope the article "how to set the excess part of html not to show" shared by the editor is helpful to you. At the same time, I hope you will support it. Pay attention to the industry information channel, more related knowledge is waiting for you to learn!

Tags: Text ellipsis part method article Chinese character guarantee time length work compulsion value interest at the same time more friends environment computer knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi Huawei Shulou Technology Docker