CSS | text-indent Property
The text-indent property in CSS is used to define the indentation of the first line in each block of text. It also take negative values. It means if the value is negative then the first line will be indented to the left.
Syntax:
text-indent: length|initial|inherit;
Property values
- length: It is used to set fixed indentation in terms of px, pt, cm, em etc. The default value of length is 0.
Syntax:
text-indent: length;
Example:
<!DOCTYPE html><html><head><title>CSS text-indent Property</title><!-- CSS text-indent property --><style>.sudo {text-indent: 70px;}.geeks {text-indent: -5em;}.gfg {text-indent: 40%;}</style></head><body><h1style="">GeeksforGeeks</h1><h2> text-indent Property</h2><h2>text-indent: 70px:</h2><divclass="sudo">Prepare for the Recruitment drive of productbased companies like Microsoft, Amazon, Adobeetc with a free online placement preparationcourse. The course focuses on various MCQ's& Coding question likely to be asked in theinterviews & make your upcoming placementseason efficient and successful.</div><h2>text-indent: -5em:</h2><divclass="geeks">Prepare for the Recruitment drive of productbased companies like Microsoft, Amazon, Adobeetc with a free online placement preparationcourse. The course focuses on various MCQ's& Coding question likely to be asked in theinterviews & make your upcoming placementseason efficient and successful.</div><h2>text-indent: 40%:</h2><divclass="gfg">Prepare for the Recruitment drive of productbased companies like Microsoft, Amazon, Adobeetc with a free online placement preparationcourse. The course focuses on various MCQ's& Coding question likely to be asked in theinterviews & make your upcoming placementseason efficient and successful.</div></body></html>chevron_rightfilter_noneOutput:

- percentage (%): It is used to define the indentation in % as compared to the width of the element.
Syntax:
text-indent: %;
Example:
<!DOCTYPE html><html><head><title>CSS text-indent Property</title><!-- CSS text-indent property --><style>.gfg {text-indent: 40%;}</style></head><body><h1style="">GeeksforGeeks</h1><h2> text-indent Property</h2><h2>text-indent: 40%:</h2><divclass="gfg">Prepare for the Recruitment drive of productbased companies like Microsoft, Amazon, Adobeetc with a free online placement preparationcourse. The course focuses on various MCQ's& Coding question likely to be asked in theinterviews & make your upcoming placementseason efficient and successful.</div></body></html>chevron_rightfilter_noneOutput:
- initial: It is used to set text-indent property to its default value.
Syntax:
text:indent: initial;
Example:
<!DOCTYPE html><html><head><title>CSS text-indent Property</title><!-- CSS text-indent property --><style>.gfg {text-indent: initial;}</style></head><body><h1style="">GeeksforGeeks</h1><h2> text-indent Property</h2><h2>text-indent: initial:</h2><divclass="gfg">Prepare for the Recruitment drive of productbased companies like Microsoft, Amazon, Adobeetc with a free online placement preparationcourse. The course focuses on various MCQ's& Coding question likely to be asked in theinterviews & make your upcoming placementseason efficient and successful.</div></body></html>chevron_rightfilter_noneOutput:
Supported Browsers: The browser supported by CSS text-indent property are listed below:
- Google Chrome 1.0
- Internet Explorer 3.0
- Firefox 1.0
- Safari 1.0
- Opera 3.5
Recommended Posts:
- HTML | DOM Style textIndent Property
- CSS | transition-property Property
- CSS | nav-right property
- CSS | right Property
- CSS | nav-down property
- CSS | nav-up property
- CSS | all Property
- CSS | top Property
- HTML | DOM URL Property
- HTML | DOM dir Property
- CSS | padding-right Property
- HTML | DOM id Property
- HTML | DOM li value Property
- CSS | direction Property
- CSS | column-gap Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



