如何允许 HTML 在指定点中断?
我知道不间断空格,但我遇到了相反的问题,谷歌甚至没有发现其他人问这个问题。
我有一段文本: (选项数量可变),我只想在斜杠处中断。防止它在其他地方损坏是微不足道的——用不间断的空格替换空格。我所困惑的是允许它在斜线后断裂。我是否只需要在斜杠后面插入一个额外的空格,即使这看起来不太好?
I know about non-breaking spaces but I've got the opposite problem and Google doesn't even find anyone else asking the question.
I have a piece of text: <option A>/<option B>/<option C>
(the number of options is variable) that I want to break only at the slashes. Keeping it from breaking elsewhere is trivial--replace the spaces with non-breaking spaces. What I'm stumped on is permitting it to break after the slashes. Do I just have to insert an extra space after the slashes even though that won't look as good?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 标签来允许浏览器在斜杠处中断:
You can use the <wbr> tag to allow the browser to break at the slashes:
使用 Unicode 零宽度空格 (U+200B)。您可以直接将它们作为字符输入 -
optionA / optionB / optionC
- 或者,因为您无法真正看到那里的零宽度空格,所以作为字符引用:optionA ;/选项B/选项C
.Use a Unicode Zero Width Space (U+200B). You can enter them directly as characters —
optionA/optionB/optionC
— or alternatively, since you can't really see the zero-width-spaces there, as character references:optionA/optionB/optionC
.