强制项目保持在同一行

发布于 2024-08-15 23:13:38 字数 501 浏览 7 评论 0原文

这应该相当简单,但我在谷歌搜索时找不到任何有用的东西。
我有一些文本和一些图标,我想确保它们保持在同一行。例如,我想要这个:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

简美 2024-08-22 23:13:38

将其放入为样式表中的空白属性指定 no-wrap 的容器中。

Put it in a container with no-wrap specified for the whitespace property in the stylesheet.

寄居人 2024-08-22 23:13:38

您需要使用不间断空格(编码为  ),以防止空格之间出现中断。

You need to use non-breaking spaces, coded   to prevent breaks in the spaces between.

暖树树初阳… 2024-08-22 23:13:38

考虑在最后一个单词和图标之间使用不间断空格   而不是空格。

例如:

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]

Consider using the non-breaking space   instead of space between the last word(s) and the icon.

For example:

Text goes here and eventually we run into the end of the line [text] [icon]

instead of

Text goes here and eventually we run into the end of the line [text] [icon]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文