I am trying to achieve this with a span:
我正在努力实现这一目标:
This is what I have:
这就是我所拥有的:
<span>some text goes here</span>
span{width:50px;overflow:hidden;float:left;}
This gives me this:
这给我:
I tried every possible way I could think of but the text keeps moving downwards. I don't want to specify the height.
我尝试了所有可能的方法,但文字一直向下。我不想指定高度。
1 个解决方案
#1
18
Use white-space: nowrap
. Otherwise the content will always expand the box vertically.
使用空白:nowrap。}否则,内容将总是垂直扩展这个框。
演示
#1
18
Use white-space: nowrap
. Otherwise the content will always expand the box vertically.
使用空白:nowrap。}否则,内容将总是垂直扩展这个框。
演示