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

Example of troubleshooting method to solve Nginx port conflict

Problem Description A Spring + Angular project wi...

Sample code for a large drop-down menu implemented in pure CSS

This is a large drop-down menu implemented purely...

Differentiate between null value and empty character ('') in MySQL

In daily development, database addition, deletion...

Example code for implementing a QR code scanning box with CSS

We usually have a scanning box when we open the c...

Summary of 4 methods of div+css layout to achieve 2-end alignment of css

The div+css layout to achieve 2-end alignment is ...

Mini Program Custom TabBar Component Encapsulation

This article example shares the specific code for...

Appreciation of the low-key and elegant web design in black, white and gray

Among classic color combinations, probably no one...

JS Easy to understand Function and Constructor

Table of contents 1. Overview 1.1 Creating a func...

MySql Group By implements grouping of multiple fields

In daily development tasks, we often use MYSQL...

In-depth understanding of CSS @font-face performance optimization

This article mainly introduces common strategies ...

How to use shell scripts in node

background During development, we may need some s...

How to monitor mysql using zabbix

Zabbix deployment documentation After zabbix is ​...

Sample code for making a drop-down menu using pure CSS

Introduction: When I looked at interview question...