Home > Web Front-end > HTML Tutorial > Automatic interception of Html long text after it exceeds the width of the tag_HTML/Xhtml_Web page production

Automatic interception of Html long text after it exceeds the width of the tag_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:40:55
Original
1351 people have browsed it

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

Copy code
The code is as follows:

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

Continuously display the English side beyond the automatic hiding (must be within a block element)

Copy the code
The code is as follows:

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

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

That’s it You can achieve the effect of automatically hiding the text that exceeds the limit.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template