css - 如何在 CSS 中打断单词时在单词末尾设置断字?

标签 css

<!DOCTYPE html>
<html>
<html lang="en">
<style type="text/css">
p {   
hyphens: auto;
word-break: break-all;
width:360px;
}
</style>
<div class="test">
<p>Web graphics are visual representations used on a Web site to enhance or enable the representation 
of an idea or feeling, in order to reach the Web site user. Graphics may entertain, educate, or emotionally 
impact the user, and are crucial to strength of branding, clarity of illustration, and ease of use for interfaces.
Examples of graphics include maps, photographs, designs and patterns, family trees, diagrams, architectural
 or engineering blueprints, bar charts and pie charts, typography, schematics, line art, flowcharts, and many other image forms.
</p>
</div>
</html>

如何将长词representations设置为两行两部分,representation在第二行末尾,sentations在第二行第三行的开头?
hyphens: auto; 不能在这里工作?
如何在断字中间添加字符-

最佳答案

为获得最佳效果,请使用 ­。它会比自动断字更有效,但它会在所有浏览器中正常工作。

<p style="width:300px; ">Web graphics are visual representations used on a Web site to enhance or enable the repre&shy;sen&shy;tation 
of an idea or feeling, in order to reach the Web site user. Graphics may enter&shy;tain, educate, or emotionally 
impact the user, and are crucial to strength of branding, clarity of illustration, and ease of use for inter&shy;faces.
Examples of graphics include maps, photo&shy;graphs, designs and patterns, family trees, diagrams, archi&shy;tectural
 or engi&shy;neering blue&shy;prints, bar charts and pie charts, typography, schematics, line art, flowcharts, and many other image forms.
</p>

关于css - 如何在 CSS 中打断单词时在单词末尾设置断字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37041843/

相关文章:

javascript - 窗口滚动事件已停止在整个域的所有实现上触发

javascript - 更改 Canvas 背景

jquery - 如何在可折叠内容面板内创建按钮并使内容可见并隐藏在其中?

css - 无法将 LESS 的片段转换为 SASS

html - Twitter Bootstrap 图标不可见

animation - 在关键帧动画之间暂停

javascript - 如何让 Accordion 面板在打开时自动向下滚动?

css - 更改 ul li 的背景颜色

html - 网站在 ie78 下不工作

css - 如何删除 :active state? 上的渐变