Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Typography

The hyphenate-character property

Reference for the CSS hyphenate-character property: set the string shown where a word is hyphenated at a line end, with a live example and support notes.

When a browser breaks a word across two lines, it shows a hyphen at the end of the first line. The hyphenate-character property lets you choose a different string for that spot. The default, auto, uses the hyphen that suits the language of the text, which is usually a regular hyphen.

This is a small typographic tool. It is mostly useful for languages or house styles that mark a break differently, or to make the effect of hyphenation obvious while you test.

CSS
p {
  hyphens: auto;
  hyphenate-character: "~";
}

Try it

A custom hyphen mark

The example uses soft hyphens (­) so the break happens in every browser. The second box shows a tilde at the line break instead of the regular hyphen. If a word does not break in your browser, resize the box until it does.

Syntax

CSS
hyphenate-character: auto | <string>;
Initial value auto
Applies to all elements
Inherited yes
Animatable no
Computed value as specified

Values

Value Description
auto The browser uses the hyphen that is right for the language of the text (usually U+2010 or a regular hyphen-minus).
<string> The string shown at the end of the line where the word is broken, such as "-", "~" or "\2010". It can have more than one character.

Usage notes

  • It works with any hyphenation. The character is shown for breaks made by hyphens: auto and for soft hyphens (&shy;). Both need hyphens to be manual or auto.
  • It is not used for literal hyphens. If the text already has a hyphen character (as in "well-known") and the line breaks there, the existing character stays.
  • Keep it short and recognizable. A strange symbol can confuse readers, and it affects the line length because the string must fit at the end of the line.
  • Copy and paste. The shown string is generated; it is not copied with the text.
  • Language. For automatic dictionary hyphenation, also set lang; see hyphens.
  • Escapes in strings. Use a CSS escape such as "\2010" to include special characters safely in a stylesheet.

Browser support

Current versions of the major browsers are expected to support it, but it is a newer property than hyphens, so check a compatibility table before relying on it. Browsers that do not support it simply show the default hyphen.