{"id":14059,"date":"2011-09-05T20:45:49","date_gmt":"2011-09-06T03:45:49","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14059"},"modified":"2022-07-18T08:48:52","modified_gmt":"2022-07-18T15:48:52","slug":"hyphenate","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/h\/hyphenate\/","title":{"rendered":"hyphens"},"content":{"rendered":"\n
The Note that Words are never hyphenated at line breaks, even if characters inside the word suggest where hyphenation could or should go.<\/p>\n\n\n Words are only broken at line breaks where there are characters inside the word that suggest line break opportunities. There are two characters that suggest line break opportunity:<\/p>\n\n\n\n Words can be broken at appropriate hyphenation points either as determined by hyphenation characters (see above) inside the word or as determined automatically by a language-appropriate hyphenation resource (if supported by the browser or provided via Conditional hyphenation characters inside a word, if present, take priority over automatic resources when determining hyphenation points within the word.<\/p>\n\n\n Deprecated, do not use<\/strong>. This was only in the spec temporarily for testing.<\/p>\n\n\n The demo below has a bunch of paragraphs and everything is set to hyphens<\/code> property controls hyphenation of text in block level elements. You can prevent hyphenation from happening at all, allow it, or only allow it when certain characters are present.<\/p>\n\n\n\n
hyphens<\/code> is language-sensitive. Its ability to find break opportunities depends on the language, defined in the
lang<\/code> attribute of a parent element. Not all languages are supported yet, and support depends on the specific browser.<\/p>\n\n\n
Syntax<\/h3>\n\n\n
.element {\n hyphens: none | manual | auto\n}<\/code><\/pre>\n\n\n
hyphens: none<\/code><\/h4>\n\n\n
hyphens: manual<\/code><\/h4>\n\n\n
U+2010<\/code> (HYPHEN): the “hard” hyphen character indicates a visible line break opportunity. Even if the line is not actually broken at that point, the hyphen is still rendered. Literally a “-“.<\/li>
U+00AD<\/code> (SHY): an invisible, “soft” hyphen. This character is not rendered visibly; instead, it suggests a place where the browser might choose to break the word if necessary. In HTML, you can use
­<\/code> to insert a soft hyphen.<\/li><\/ul>\n\n\n
hyphens: auto<\/code><\/h4>\n\n\n
@hyphenation-resource<\/code>).<\/p>\n\n\n\n
hyphens: all<\/code><\/h4>\n\n\n
Demo<\/h3>\n\n\n
hyphens: auto;<\/code> to demonstrate the concept of hyphenation. The
lang<\/code> attribute is set to
en<\/code> on the parent element.<\/p>\n\n\n\n