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
Dataframe is a new API introduced in Spark 1.3.0,...
This article example shares the specific code of ...
Table of contents 1. Generate a certificate 2. En...
Table of contents 1. Preparation 2. Decompression...
1. Referential Integrity Referential integrity re...
Note: Currently, the more popular front-end frame...
1. What is mycat A completely open source large d...
When making a new version of the configuration in...
<br />Some web pages may not look large but ...
I believe everyone is familiar with database inde...
MySQL multi-table query (Cartesian product princi...
This article example shares the specific code of ...
Table of contents 1. Background 2. Table creation...
1. HTML tags with attributes XML/HTML CodeCopy co...
Table of contents Overview Four examples Example ...