Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Overflow hidden if text length increases jquery

Overflow hidden if text length increases jquery

Problem

see this fiddle first hand!.

What i have is a div with a string. Now whenever i hover the .dots it makes its text inside bolder which increases its length or size . I want something like if the text size increases then it should not dissapear like overflow:hidden but show appear followed by 3 dots. for example look at this image........

since the name is too long it appears followed be dots. How can i possibly do that ?

Problem courtesy of: HackerManiac

Solution

It's a very easy solution. Just add this to your .dots css :

white-space: nowrap;
text-overflow: ellipsis;

So your css looks like this:

.dots {
    height:20px;
    width:150px;
    background:#fff;
    border:1px solid #DDD;
    color:#333;
    overflow:hidden;
    padding:2px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

See the fiddle i made.

Solution courtesy of: Sten Pelzer

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Overflow hidden if text length increases jquery

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×