CSS textindent Property (original) (raw)

CSS text-indent Property

Last Updated : 28 May, 2026

The text-indent property in CSS is used to specify the indentation of the first line of text in a block or paragraph. It helps create organized and visually appealing text layouts.

**Syntax:

text-indent: length | initial | inherit;

**Property values:

**Example: Here, we are using text-indent: length; property.

html `

CSS text-indent Property
<!-- CSS text-indent property -->
<style>
    .sudo {
        text-indent: 70px;
    }

    .geeks {
        text-indent: -5em;
    }

    .gfg {
        text-indent: 40%;
    }
</style>

GeeksforGeeks

text-indent Property

<h2>text-indent: 70px:</h2>
<div class="sudo">
    Prepare for the Recruitment drive of product
    based companies like Microsoft, Amazon, Adobe
    etc with a free online placement preparation
    course. The course focuses on various MCQ's
    & Coding question likely to be asked in the
    interviews & make your upcoming placement
    season efficient and successful.
</div>

<h2>text-indent: -5em:</h2>
<div class="geeks">
    Prepare for the Recruitment drive of product
    based companies like Microsoft, Amazon, Adobe
    etc with a free online placement preparation
    course. The course focuses on various MCQ's
    & Coding question likely to be asked in the
    interviews & make your upcoming placement
    season efficient and successful.
</div>

<h2>text-indent: 40%:</h2>
<div class="gfg">
    Prepare for the Recruitment drive of product
    based companies like Microsoft, Amazon, Adobe
    etc with a free online placement preparation
    course. The course focuses on various MCQ's
    & Coding question likely to be asked in the
    interviews & make your upcoming placement
    season efficient and successful.
</div>

`

**Example: Here, we are using text-indent: %; property.

html `

CSS text-indent Property
<!-- CSS text-indent property -->
<style>
    .gfg {
        text-indent: 40%;
    }
</style>

GeeksforGeeks

text-indent Property

<h2>text-indent: 40%:</h2>
<div class="gfg">
    Prepare for the Recruitment drive of product
    based companies like Microsoft, Amazon, Adobe
    etc with a free online placement preparation
    course. The course focuses on various MCQ's
    & Coding question likely to be asked in the
    interviews & make your upcoming placement
    season efficient and successful.
</div>

`

**Example: Here, we are using text-indent: initial; property.

html `

CSS text-indent Property
<!-- CSS text-indent property -->
<style>
    .gfg {
        text-indent: initial;
    }
</style>

GeeksforGeeks

text-indent Property

<h2>text-indent: initial:</h2>
<div class="gfg">
    Prepare for the Recruitment drive of product
    based companies like Microsoft, Amazon, Adobe
    etc with a free online placement preparation
    course. The course focuses on various MCQ's
    & Coding question likely to be asked in the
    interviews & make your upcoming placement
    season efficient and successful.
</div>

`