css--Two lines display ellipsis compatible with Firefox browser

Source: Internet
Author: User

css--Two lines display ellipsis compatible with Firefox browser

Normal wording:

. Ellipse1 {overflow: hidden; white-space: nowrap; text-overflow: ellipsis;} . Ellipse2 {overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;}

Summed up is: fixed width, forced not to wrap, beyond the hidden, display ellipsis. Four properties

But it's not compatible under Firefox:

Compatible Practices:

P{position:relative;Line-height:20px;Max-height:40px;Overflow:Hidden;}P::after{content: "...";position:Absolute;Bottom:0; Right:0;Padding-left:40px;background:-webkit-linear-gradient (left, Transparent, #fff 55%);background:-o-linear-gradient (right, transparent, #fff 55%);background:-moz-linear-gradient (right, transparent, #fff 55%);background:Linear-gradient (to right, transparent, #fff 55%);}
    1. Sets the height to an integer multiple of line-height to prevent the outside text from revealing.
    2. Add a gradient background to P::after to prevent text from appearing in half.
    3. Because IE6-7 does not display content, it is necessary to add a label compatible with ie6-7 (such as:<span>...<span/>); compatible IE8 needs to be replaced by: after.

css--Two lines display ellipsis compatible with Firefox browser

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.