CSS空白プロパティ
例
空白プロパティのさまざまな値を示します。
p.a {
white-space: nowrap;
}
p.b {
white-space: normal;
}
p.c {
white-space:
pre;
}
定義と使用法
このwhite-space
プロパティは、要素内の空白の処理方法を指定します。
デフォルト値: | 正常 |
---|---|
遺伝性の: | はい |
アニメート可能: | 番号。アニメート可能について読む |
バージョン: | CSS1 |
JavaScript構文: | object .style.whiteSpace = "nowrap" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
white-space | 1.0 | 8.0 | 3.5 | 3.0 | 9.5 |
CSS構文
white-space: normal|nowrap|pre|pre-line|pre-wrap|initial|inherit;
プロパティ値
Value | Description | Play it |
---|---|---|
normal | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default | |
nowrap | Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered | |
pre | Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the <pre> tag in HTML | |
pre-line | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks | |
pre-wrap | Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
関連ページ
CSSチュートリアル:CSSテキスト
HTML DOMリファレンス:whiteSpaceプロパティ