jQuerybeast
jQuerybeast

Reputation: 14490

How can I make a span text overflow, like an input

I am trying to achieve this with a span:

enter image description here

This is what I have:

<span>some text goes here</span>

span{width:50px;overflow:hidden;float:left;}

This gives me this:

enter image description here

I tried every possible way I could think of but the text keeps moving downwards. I don't want to specify the height.

Upvotes: 17

Views: 12177

Answers (1)

nikc.org
nikc.org

Reputation: 16952

Use white-space: nowrap. Otherwise the content will always expand the box vertically.

Demo

Upvotes: 19

Related Questions