Перейти к содержимому

Свойство CSS text-justify

Свойство text-justify определяет поведение интервала между словами или символами.

Свойство text-justify является одним из свойств CSS3.

Свойство text-justify выбирает метод выравнивания текста, когда для text-align установлено значение "justify".

Начальное значениеauto
Применяется кЭлементы блочного уровня.
НаследуетсяНет.
АнимацияНет.
ВерсияCSS3
Синтаксис DOMobject.style.textJustify = "inter-character";

Синтаксис

Значения CSS text-justify

css
text-justify: auto | inter-word | inter-character | none | initial | inherit;

Пример свойства text-justify:

Пример кода CSS text-justify

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-align: justify;
        text-justify: inter-word;
      }
    </style>
  </head>
  <body>
    <h2>Text-justify property example</h2>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
  </body>
</html>

Результат

Значение inter-word свойства CSS text-justify

В следующем примере измените размер окна браузера, чтобы увидеть, как работает "justify":

Пример свойства text-justify со значением "inter-character":

Пример использования значения inter-character в CSS text-justify

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
        text-align: justify;
        text-justify: inter-character;
      }
    </style>
  </head>
  <body>
    <h2>Text-justify property example</h2>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
  </body>
</html>

Примечание: Поддержка text-justify в браузерах ограничена. Значение inter-character не поддерживается в большинстве современных браузеров.

Значения

ЗначениеОписаниеЗапустить
autoАлгоритм выравнивания определяется автоматически. Браузер сам решает, что лучше использовать: интервал между словами или между символами. Это значение по умолчанию для данного свойства.Запустить »
inter-wordБраузер увеличивает интервал между словами. Это типично для языков с четкими границами слов.Запустить »
inter-characterБраузер увеличивает интервал между символами при выравнивании.Запустить »
noneВыравнивание по ширине отключено.Запустить »
initialУстанавливает для свойства значение по умолчанию.Запустить »
inheritНаследует значение свойства от родительского элемента.

Практика

Какие существуют значения свойства 'text-justify' в CSS и что они означают?

Считаете ли это полезным?

Предпросмотр dual-run — сравните с маршрутами Symfony на продакшене.