スタイルtextIndentプロパティ
例
<div>要素の最初の行を50ピクセルでインデントします。
document.getElementById("myDiv").style.textIndent = "50px";
定義と使用法
textIndentプロパティは、テキストの最初の行のインデントを設定または返します。
注:負の値を使用できます。値が負の場合、最初の行は左にインデントされます。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
textIndent | Yes | Yes | Yes | Yes | Yes |
構文
textIndentプロパティを返します。
object.style.textIndent
textIndentプロパティを設定します。
object.style.textIndent = "length|%|initial|inherit"
プロパティ値
Value | Description |
---|---|
length | Defines the indentation in length units. Default value is 0 |
% | Defines the indentation in % of the width of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | 0 |
---|---|
戻り値: | 要素のテキストの最初の行のインデントを表す文字列 |
CSSバージョン | CSS1 |
その他の例
例
<div>要素のテキストインデントを返します。
alert(document.getElementById("myDiv").style.textIndent);
関連ページ
CSSチュートリアル:CSSテキスト
CSSリファレンス:text-indentプロパティ
❮スタイルオブジェクト