Home >Web Front-end >CSS Tutorial >How to indent the first line of text in css
How to indent the first line of text in css: You can use the text-indent attribute, such as [text-indent:50px;]. The text-indent attribute specifies the indentation of the first line of text in the text block, which is often used to create a tab page effect.
Attribute introduction:
The text-indent attribute specifies the indentation of the first line of text in the text block.
(Learning video recommendation: css video tutorial)
Note: Negative values are allowed. If a negative value is used, the first line will be indented to the left.
Note: Before CSS 2.1, text-indent always inherited a calculated value, rather than a declared value.
Attribute description:
is used to define the indentation of the first content line in block-level elements. This is most commonly used to create a "tab" effect. Allows specifying negative values, which creates a "hanging indent" effect.
Attribute value:
length 定义固定的缩进。默认值:0。 % 定义基于父元素宽度的百分比的缩进。 inherit 规定应该从父元素继承 text-indent 属性的值。
Example:
p { text-indent:50px; }
Related recommendations: CSS tutorial
The above is the detailed content of How to indent the first line of text in css. For more information, please follow other related articles on the PHP Chinese website!