Sohil Desai
Sohil Desai

Reputation: 2988

Hide overflow text in span using css

I want to display a long text inside fixed height & width of span element.

I have a text displaying current something like this inside span element

My Skill is
  Web 
Designing.

i have given him this CSS

span
{
    display:block;
    height:40px;
    width:90px;
    overflow:hidden;
    text-overflow:ellipsis;
}

it give me result like this

My Skill is
  Web 

but It is not my desired result. I want it to display something like this

My Skill is
  Web...

Is there any way to solve this problem..?? Thank you in advance..

Upvotes: 0

Views: 6860

Answers (1)

Daniel Morgan
Daniel Morgan

Reputation: 561

You need to add the following property in span rule

white-space: nowrap; 

Upvotes: 5

Related Questions