Css-text-indent
提供:Dev Guides
CSS-テキストインデント
説明
_text-indent_プロパティは、ブロックレベル要素のテキストの最初の行のインデント距離を定義します。
可能な値
- length -長さの値。 プロパティには負の長さが許可されており、「ハンギングインデント」効果が得られます。
- percentage -テキストの最初の行は、要素の包含ブロックの幅に相対的な距離だけインデントされます。
に適用されます
すべてのブロックレベル要素。
DOM構文
object.style.textIndent = "20px";
例
以下は、段落の最初の行をインデントする方法を示す例です-
<html>
<head>
</head>
<body>
<p style = "text-indent:1cm;">
This text will have first line indented by 1cm
</p>
<p style = "text-indent:1cm;">
this line will remain at its actual position this is done by
CSS text-indent property.
</p>
</body>
</html>
これにより、次の結果が生成されます–