Get the App
SLTechnology News&Howtos  ›  Development  › 

How to achieve automatic interception of Html long text when it exceeds the width of the tag

Shulou Source: shulou.com Published: 2022-06-01 05:39:05 10月01日 Update

Today, I would like to share with you the relevant knowledge points about how to intercept automatically after Html long text exceeds the width of the mark. the content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

The code is as follows:

White-space:nowrap;white-space:norma;display:inline-block

Beyond auto-hide British continuous row display (must be in block element)

The code is as follows:

Overflow:hidden;white-space:nowrap

If you want to add a... at the end of the text, you can use text-overflow: ellipsis;. Most mainstream browsers support this attribute.

The code is as follows:

.tbconxx {

Float: left

Width: 255px

Padding: 5px 10px

}

.tbconxx li,tbconxx span {

Padding-left: 7px

Text-overflow: ellipsis

Overflow: hidden

Display: block

White-space: nowrap

Width: 240px

}

In this way, you can achieve the effect of automatic hiding of excess text.

These are all the contents of this article entitled "how to automatically intercept Html long text beyond the width of the tag". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Knowledge articles code width text tags content text different large mainstream elements most that is attributes effects more browsers knowledge points UK Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi OPPO Reno Linux macOS Docker