Html 跨度上的空白 nowrap
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27013259/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
whitespace nowrap on span
提问by Mina
In this case:
在这种情况下:
<td>
Some Text
<span class="Icon"></span>
</td>
I want to get the line break when necessary on my Text but I don't want my span to get on a new line, I want it to always stick to part of the text. How can I do it?
我想在必要时在我的文本上换行,但我不希望我的跨度出现在新行上,我希望它始终坚持文本的一部分。我该怎么做?
Thanks,
谢谢,
回答by Mina
回答by Jukka K. Korpela
Replace all whitespace before the span
with a single no-break space (if you want some spacing to appear between your text and whatever rendering you have styled for the span
; if no spacing is desired, omit the
).
用span
单个不间断空格替换 之前的所有空白(如果您希望在文本和为 设置样式的任何渲染之间出现一些间距span
;如果不需要间距,请省略
)。
<td>
Some Text <span class="Icon"></span>
</td>