The hyphens property

The hyphens property enables browser hyphenation using the hyphen "-". To support the Russian language, you need to add the lang="ru" attribute to the tag to which hyphens are applied (or to the parent of this tag). You can simply add this attribute to the html tag. Without this, hyphenation will not work.

Syntax

cssselector {
  hyphens: auto | manual | none;
}

Values

Value Description
auto Places hyphenation marks where necessary.
manual Adds hyphens only in those places where the wbr tag or the special character ­ is added and only if necessary. Such hyphens are called soft.
none Cancels hyphenation (words will not be hyphenated, even if there are soft hyphens).

Default value: manual.

The auto value

html<p lang="en">
  Lorem ipsum dolor sit amet, consectetur adipiscing elitorire
  aenean a dapibus magna, ac interdum nisl. Suspendisse egetil
  fringilla nibh, eu commodo arcu. Donec lacinia tempor velite
  sed tincidunt. Aliquam porttitor nulla purus, vel vulputater
  ipsum faucibus sed. Phasellus sodales, lorem vel cursus vehi
  ante purus lacini dui, interdum fringilla massa eros ut duir
  nullam et ipsum ex. Donec ut iaculis massa. Duis vel ulamcor
  per dolor. Suspendisse tristique dolor risus, nec laoreet du
  aliquet maximus. Maecenas tempus congue arcu, si amet auctor
  dui efficitur in. Proin ac auctor nisi. Phasellus luctus eur
  neque sollicitudin rutrum. Curabitur ipsum justo, sodales in
  lectus non, molestie ullamcorper elit, orciro varius natoque.
</p>
cssp {
  width: 400px;
  hyphens: auto;
  border: 1px solid red;
  text-align: justify;
}

Результат:

See also

  • the word-break and overflow-wrap properties
    that allow you to move the letters of a long word to a new line
  • the overflow property
    that cuts off content parts that extend beyond block boundaries