CSS textalignlast Property (original) (raw)

CSS text-align-last Property

Last Updated : 28 May, 2026

The text-align-last property in CSS is used to specify the alignment of the last line of text in a paragraph or block element. It helps control the appearance of the final line, improving text presentation and layout consistency.

Understanding the text-align-last Property

The text-align-last property in CSS specifies the alignment of the last line of text within an element. It is particularly useful for adjusting the alignment of text that ends abruptly, such as in headlines, subheadings, or paragraphs.

**Syntax:

text-align-last: auto | start | end | left | right | center | justify | initial | inherit;

**Default Value: Its default value is auto.

**Property Values:

**Example: Here, we are using text-align-last: left; property.

HTML `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: left;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: left;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: right; property

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: right;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: right;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: center; property.

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: center;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: center;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: justify; property.

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: justify;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: justify;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: start; property.

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: start;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: start;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: end; property.

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: end;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: end;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: auto; property.

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: auto;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: auto;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`

**Example: Here, we are using text-align-last: initial; property

html `

text-align-last property
<!-- CSS style to text-align-last property -->
<style>
    p {
        text-align-last: initial;
        font-family: sans-serif;
        border: 1px solid black;
    }
</style>
<h2 style="text-align:center">
    text-align-last: initial;
</h2>

<!-- text-align-last: left; property -->
<p>
    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.
</p>

<!-- text-align-last: right; property -->
<p> GeeksForGeeks: A computer science portal</p>

`