CSSの行の高さのプロパティ
例
さまざまな<div>要素の行の高さを設定します。
div.a {
line-height: normal;
}
div.b {
line-height: 1.6;
}
div.c {
line-height:
80%;
}
div.d {
line-height: 200%;
}
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
line-height
プロパティは、線の高さを指定します。
注:負の値は許可されていません。
デフォルト値: | 正常 |
---|---|
遺伝性の: | はい |
アニメート可能: | はい。アニメート可能について読む |
バージョン: | CSS1 |
JavaScript構文: | object .style.lineHeight = "30px" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
CSS構文
line-height: normal|number|length|initial|inherit;
プロパティ値
Value | Description | Play it |
---|---|---|
normal | A normal line height. This is default | |
number | A number that will be multiplied with the current font-size to set the line height | |
length | A fixed line height in px, pt, cm, etc. | |
% | A line height in percent 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 |
その他の例
例
さまざまな<div>要素の行の高さをピクセルとセンチメートルで設定します。
div.a {
line-height: 10px;
}
div.b {
line-height: 30px;
}
div.c {
line-height:
0.5cm;
}
div.d {
line-height: 1cm;
}
例
さまざまな<div>要素の数値として行の高さを設定します。
div.a {
line-height: 0.5;
}
div.b {
line-height: 1.6;
}
div.c {
line-height: 2;
}
関連ページ
CSSチュートリアル:CSSテキスト
HTML DOMリファレンス: lineHeightプロパティ