The client (CSS) solves the problem of automatically intercepting the string length and... Replace

Source: Internet
Author: User

Generally, when reading the title of an article, when we encounter too many characters, the program intercepts a certain number of characters on the server side, and then adds... to capture the title length. In fact, we can also control it through CSS.

 

The actual column is as follows:

. Title
{
Width: 200px;
White-space: nowrap;
Word-break: Keep-all;
Overflow: hidden;
Text-overflow: ellipsis;
}

SPAN or Div references are available, for example:

<SPAN class = title> the title displayed on the client is too long. the unused part is omitted and the ellipsis is added. </span>

<Div class = title> the client solves the problem. The title is displayed too long. the unused part is omitted and the ellipsis is added. </div>

The above two examples show that after the PX width of the style definition is exceeded, the subsequent characters will be replaced.

 

The actual column is as follows:

. Title
{
Width: 200px;
White-space: nowrap;
Word-break: Keep-all;
Overflow: hidden;
Text-overflow: ellipsis;
}

SPAN or Div references are available, for example:

<SPAN class = title> the title displayed on the client is too long. the unused part is omitted and the ellipsis is added. </span>

<Div class = title> the client solves the problem. The title is displayed too long. the unused part is omitted and the ellipsis is added. </div>

The above two examples show that after the PX width of the style definition is exceeded, the subsequent characters will be replaced.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.