<!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>
&#13;
如何将长单词representations
设置为两行中的两个部分,第二行末尾为repre-
,第三行为sentations
?
hyphens: auto;
无法在这里工作?
如何在突破单词的中间添加字符-
?
答案 0 :(得分:2)
为获得最佳效果,请使用­
。这将比自动连字更多,但它可以在所有浏览器中正常工作。
<p style="width:300px; ">Web graphics are visual representations used on a Web site to enhance or enable the repre­sen­tation
of an idea or feeling, in order to reach the Web site user. Graphics may enter­tain, educate, or emotionally
impact the user, and are crucial to strength of branding, clarity of illustration, and ease of use for inter­faces.
Examples of graphics include maps, photo­graphs, designs and patterns, family trees, diagrams, archi­tectural
or engi­neering blue­prints, bar charts and pie charts, typography, schematics, line art, flowcharts, and many other image forms.
</p>
答案 1 :(得分:1)
这是你要找的那个。 希望这会有所帮助。
<!DOCTYPE html>
<html>
<html lang="en">
<style type="text/css">
p {
hyphens: auto;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
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>
&#13;
我们可以看到结果正如预期的那样正常 在Firefox和其他一些浏览器中使用(连字符),在谷歌浏览器中,即使连字符似乎不能正常工作但它不会破坏单词,它会正确调整单词。