长行句的断句方法
我正在为我的网站开发一个 iPhone 主题,您能否将一个长句子分成这样的内容:
A long sentence would go past the iPhone screen and I need this to break
变成这样:
A long sentence would go past the iPhone
screen and I need this to break
显示如下:
I'm developing an iPhone theme for my website, can you be able to break a long sentence something like this:
A long sentence would go past the iPhone screen and I need this to break
Into this:
A long sentence would go past the iPhone
screen and I need this to break
Showing like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的文本有空格,则为换行元素添加宽度将自动破坏文本。但如果您的文本没有空格(例如链接),您可以使用
break-word
:if your text has spaces then adding a width for the wrap element will break the text automatically. But if you have a text without a space (such as a link) you can use
break-word
:根据: https://developer.mozilla.org/en-US/docs /Web/CSS/white-space#Browser_compatibility
word-wrap
似乎不再起作用,请改用white-space
As per: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#Browser_compatibility
word-wrap
doesn't seem to work any more, usewhite-space
instead我认为问题在于“视口”比设备的屏幕更宽。请参阅这篇文章了解一些背景信息以及可能的解决方案。
I think the problem is that the "viewport" is wider than the device's screen. See this post for some background and possible solution.