强制项目保持在同一行
这应该相当简单,但我在谷歌搜索时找不到任何有用的东西。
我有一些文本和一些图标,我想确保它们保持在同一行。例如,我想要这个:
Text goes here and eventually we run into the end of the line [text][icon]
或这个:
Text goes here and eventually we run into the end of the line
[text][icon]
但不是这个:
Text goes here and eventually we run into the end of the line [text]
[icon]
当谷歌搜索时我能想到的唯一一件事是显然 IE 在实现这个方面存在一些问题。我真的不在乎 IE 是否能够做到这一点(至少现在还不能),我只是想找到一个解决方案......:)
This should be fairly simple, but I have not been able to find anything usefull when google-ing.
What I have is some text and some icons that I want to ensure that stays on the same line. For example I want this:
Text goes here and eventually we run into the end of the line [text][icon]
or this:
Text goes here and eventually we run into the end of the line
[text][icon]
but not this:
Text goes here and eventually we run into the end of the line [text]
[icon]
The only thing I've been able to come up with when google-ing is that apparently IE has some problems implementing this. I don't really care if IE is able to do it or not (at least not yet), I just want to find a solution... :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将其放入为样式表中的空白属性指定 no-wrap 的容器中。
Put it in a container with no-wrap specified for the whitespace property in the stylesheet.
您需要使用不间断空格(编码为
),以防止空格之间出现中断。
You need to use non-breaking spaces, coded
to prevent breaks in the spaces between.
考虑在最后一个单词和图标之间使用不间断空格
而不是空格。
例如:
代替
Consider using the non-breaking space
instead of space between the last word(s) and the icon.
For example:
instead of