我可以使用CSS在一行的末尾用连字符来表示文本吗? [英] Can I use CSS to justify text with hyphenating words at the end of a line?

查看:155
本文介绍了我可以使用CSS在一行的末尾用连字符来表示文本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div太窄,text-align:justify(间隙太宽),但是看起来不统一,当右或左对齐,因为那么在行的末端有一个大的差距。左对齐看起来最好,但我可以使用连字,就像在书中?使用CSS?

I have a div that is too narrow to text-align:justify (gaps too wide), but yet looks un-uniform when right- or left-justified, because then there is a large gap at the end of lines. Left-justified looks best, but could I use hyphenation, like in books? Using CSS?

推荐答案

您可以使用 hyphens:auto 已经在HTML中声明了内容语言,例如使用< html lang = zh-CN>

You can use hyphens: auto provided that you have declared the content language in HTML, e.g. using <html lang=en-US>.

浏览器支持仍然有限, b $ b http://caniuse.com/css-hyphens

Browser support is still limited but getting better, see http://caniuse.com/css-hyphens

对于良好的质量,您可能需要手动控制连字,例如通过在可能连字符错误的字词中使用软连字符(& shy; )。

For good quality, you may need to manually control hyphenation e.g. by using soft hyphens (&shy;) in words that might otherwise be hyphenated wrong.

这篇关于我可以使用CSS在一行的末尾用连字符来表示文本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆