Extra text converted to ellipsis CSS

Source: Internet
Author: User

1.text-overflow:ellipsis implementation

Overflow:hidden;text-overflow:ellipsis;//clip|ellipsiswhite-space:nowrap;

2.-webkit-line-clamp

Width:200px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient : Vertical;border:solid 1px black;

3. Use the Include ellipsis (...) The implementation of elemental simulation

. demo {    height:200px;    width:200px;    position:relative;    Line-height:1.4em;    Height:4.2em;    Overflow:hidden;}. Demo::after {    content: "...";    Font-weight:bold;    Position:absolute;    bottom:0;    right:0;    padding:0 -20px 1px 45px;    Background-color:white;}

Here, a pseudo-element with an ellipsis and a white background color obscures some of the content. Height is three times times higher than line-height. You need to display a few lines of text set to several times.

This way of thinking is relatively simple, compatibility is better

Extra text converted to ellipsis CSS

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.