目录

text-indent

描述 (Description)

text-indent属性定义块级元素中第一行文本的缩进距离。

可能的值 (Possible Values)

  • length - 任何长度值。 酒店允许负长度,并产生“悬挂缩进”效果。

  • percentage - 第一行文本缩进相对于元素包含块宽度的距离。

适用于 (Applies to)

所有块级元素。

DOM语法 (DOM Syntax)

object.style.textIndent = "20px";

例子 (Example)

以下是演示如何缩进段落第一行的示例 -

<html>
   <head>
   </head>
   <body>
      <p <b class="notranslate">style = "text-indent:1cm;"</b>>
         This text will have first line indented by 1cm 
      </p>
      <p <b class="notranslate">style = "text-indent:1cm;"</b>>
         this line will remain at its actual position this is done by 
         CSS text-indent property.
      </p>
   </body>
</html> 

这将产生以下结果 -

新页面打开
↑回到顶部↑
WIKI教程 @2018