When we display long text, we often need to intercept characters on the C# side, but this is definitely not a good aspect, because our long text is often tagged with HTML. If you don't load it well, garbled characters will appear. (Half HTML mark appears), and a better way is to use CSS to implement this function
span tag will force continuous line wrapping when the content exceeds the limit
white-space:nowrap;white-space:norma;display:inline-block;
Continuously display the English side beyond the automatic hiding (must be within a block element)
overflow:hidden;white-space:nowrap;
And if you want to add a... after the text, you can use text-overflow: ellipsis;General Major browsers support this attribute
.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;
}
That’s it You can achieve the effect of automatically hiding the text that exceeds the limit.