Home > Article > Web Front-end > How to set the indentation of the first line of html
The way to set the indentation of the first line of HTML is to add the text-indent attribute to the paragraph text and set a reasonable indentation value, such as [p {text-indent:50px;}].
The operating environment of this article: windows10 system, html 5, thinkpad t480 computer.
We can use the text-indent attribute to achieve the indentation effect of the first line of text. It is very simple to use. There may be many friends who don’t know much about the text-indent attribute. Let’s take a look at the text-indent attribute.
The text-indent attribute specifies the indentation of the first line of text in a text block.
Attribute value:
length defines fixed indentation. Default value: 0.
% Defines the indent based on a percentage of the width of the parent element.
#inherit Specifies that the value of the text-indent attribute should be inherited from the parent element.
Code example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <style> p {text-indent:50px;} </style> </head> <body> <p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. </p> </body> </html>
The running effect is as shown below:
Related recommendations: html video tutorial
The above is the detailed content of How to set the indentation of the first line of html. For more information, please follow other related articles on the PHP Chinese website!