I have a floated span with some text. I have set the overflow to hidden and the width to a fixed width say 100px.
Now when the text becomes too long it just wraps.
I don’t want to set the height to a fixed px because that way if I change the font-size I may forget to update the height and so on.
<span style="float:left;overflow:hidden;width:100px;">Very Long Text</span>
Sounds like you might want to try something like:
CSS:
HTML:
If you really want to use a
<span>rather than a floated<div>, you’ll want to set the span’sdisplaytoinline-block. This will let you specify thewidthwhile keeping its other inline attributes.