html sets the indentation of the first line of page text

王林
Release: 2020-02-24 17:51:21
forward
6834 people have browsed it

html sets the indentation of the first line of page text

text-indent attribute introduction

Attribute value unit: em, 1em means indenting 1 word, 2em means indenting 2 words...

Note: The value of the text-indent attribute supports negative numbers.

(Related tutorial recommendations: html introductory tutorial)

Demo code:

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>设置首行缩进</title>
    <style>
        p{            
                text-indent: 2em;
        }
      </style>
      </head>
      <body>
    <p>成功不是打败别人,而是改变自己。
        成功不是打败别人,而是改变自己。成功不是打败别人,而是改变自己。
        成功不是打败别人,而是改变自己。成功不是打败别人,而是改变自己。
        成功不是打败别人,而是改变自己。成功不是打败别人,而是改变自己。
        成功不是打败别人,而是改变自己。成功不是打败别人,而是改变自己。
        成功不是打败别人,而是改变自己。成功不是打败别人,而是改变自己。
        成功不是打败别人,而是改变自己。成功不是打败别人,而是改变自己。    
</p>
</body>
</html>
Copy after login

The result is as shown in the figure:

html sets the indentation of the first line of page text

For more programming-related content, please pay attention to the Programming Introduction column on the php Chinese website!

The above is the detailed content of html sets the indentation of the first line of page text. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template