Свойство стиля lineHeight
Пример
Установите высоту строки для элемента <div>:
document.getElementById("myDiv").style.lineHeight = "3";
Определение и использование
Свойство lineHeight устанавливает или возвращает расстояние между строками в тексте.
Поддержка браузера
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
Синтаксис
Вернуть свойство lineHeight:
object.style.lineHeight
Установите свойство lineHeight:
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Значения свойств
Value | Description |
---|---|
normal | Normal line height is used. This is default |
number | A number that will be multiplied with the current font size to set the line height |
length | Defines the line height in length units |
% | Defines the line height in % of the current font size |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Технические детали
Значение по умолчанию: | нормальный |
---|---|
Возвращаемое значение: | Строка, представляющая расстояние между строками в тексте. |
CSS-версия | CSS1 |
Дополнительные примеры
Пример
Возвращает высоту строки элемента <div>:
alert(document.getElementById("myDiv").style.lineHeight);
Связанные страницы
Учебное пособие по CSS: Текст CSS
Справочник по CSS: свойство line-height
❮ Объект стиля