CSS Text-overflow over width display ellipsis

Source: Internet
Author: User
The use of text-overflow:ellipsis to overflow text display ellipsis has two advantages, one is not through the program to limit the number of words, the second is conducive to SEO. You need to use a list of article headings that display ellipses for overflow text, which is more friendly to search engines because the title is not actually truncated, but is limited to width and not displayed. The

usual practice is this:
1.overflow:hidden;
2.text-overflow:ellipsis;
3.-o-text-overflow:ellipsis;
4.white-space:nowrap;
5.width:100%;

Among them, Overflow:hidden and white-space:nowrap are necessary, otherwise the ellipsis will not be displayed;-o-text-overflow:ellipsis is for opera, and the width is set mainly for IE6;

This method supports Internet Explorer, Safari, Chrome, and Opera, but FF does not support it, but it can be done with jquery for similar effects.

Download this jquery plugin: jquery ellipsis plugin

call method:
1.$ (document). Ready (function () {
2.    $ ('. Ellipsis '). ellipsis ();
3.}
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.