Home  >  Article  >  Web Front-end  >  How to indent html

How to indent html

藏色散人
藏色散人Original
2021-05-13 10:29:1618540browse

html Method to achieve indentation effect: First create an HTML sample file; then enter some text content in the body; finally specify the indentation of the first line of text in the text block through the "text-indent" attribute .

How to indent html

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer

How to indent html?

First of all, we need to understand the attribute text-indent. This label is used to indent the first line. Its unit is the length unit or percentage.

The text-indent attribute specifies the first line in the text block. The indentation of the text.

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.

Example:

<html>
<head>
<style type="text/css">
p {text-indent: 1cm}
</style>
</head>

<body>
<p>
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
这是段落中的一些文本。
</p>
</body>

</html>

Effect:

How to indent html

##Recommended study: "

HTML video tutorial

The above is the detailed content of How to indent html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn