当文本对于 div 框来说太小并且应该有换行选项时如何放置“-”。
div id="box"> TExttexttexttext </div>
#box { border:1px solid #000;
width:50px;
height:auto;
word-wrap: break-word;
}
我希望文本在另一行中放置“-”。
最佳答案
查看 CSS 属性“连字符”
http://css-tricks.com/almanac/properties/h/hyphenate/
#box { border:1px solid #000;
width:50px;
height:auto;
word-wrap: break-word;
hyphens:auto;
}
请注意,您必须使用 -webkit、-moz 等前缀来实现各自的跨浏览器兼容性
关于html - 断字时放行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20381829/