Html long text automatically cuts off when it exceeds the tag width

Html long text automatically cuts off when it exceeds the tag width
When we display long text, we often need to intercept characters on the C# side, but this is definitely not a good thing, because our long text is often represented by HTML tags. If you don't load it properly, garbled characters will appear (half of the HTML tag will appear). A better way is to implement this function through CSS.
When the span tag exceeds the limit, it will automatically wrap the content.

Copy code
The code is as follows:

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

If the line exceeds the auto-hidden area, it will not be displayed in a row (must be in a block element)

Copy code
The code is as follows:

overflow:hidden;white-space:nowrap;

If you want to add a ... after the text, you can use text-overflow: ellipsis; most mainstream browsers support this attribute

Copy code
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;
}

This will automatically hide the text that exceeds the limit.

<<:  Simplify complex website navigation

>>:  Introduction and architecture of Apache Arrow, a high-performance data format library package on JVM (Gkatziouras)

Recommend

MySQL Billions of Data Import, Export and Migration Notes

I have been taking a lot of MySQL notes recently,...

How to monitor Linux server status

We deal with Linux servers every day, especially ...

CSS3 realizes particle animation effect when matching kings

When coding, you will find that many things have ...

How to make a div height adaptive to the browser height

This old question has troubled countless front-end...

mysql-canal-rabbitmq installation and deployment super detailed tutorial

Table of contents 1.1. Enable MySQL binlog 1.2. C...

Detailed explanation of the payment function code of the Vue project

1. Alipay method: Alipay method: Click Alipay to ...

js uses FileReader to read local files or blobs

Table of contents FileReader reads local files or...

Detailed analysis of classic JavaScript recursion case questions

Table of contents What is recursion and how does ...

How to clear mysql registry

Specific method: 1. Press [ win+r ] to open the r...

How to bind domain name to nginx service

Configure multiple servers in nginx.conf: When pr...

Implementing a simple calculator with javascript

This article example shares the specific code of ...

Implementing a shopping cart with native JavaScript

This article shares the specific code of JavaScri...

XHTML Getting Started Tutorial: XHTML Hyperlinks

It is no exaggeration to say that hyperlinks conne...