スタイル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プロパティ
❮スタイルオブジェクト