Open In App
Related Articles

How to align the last line of a paragraph element to the right using CSS?

Improve Article
Save Article
Like Article

In this article, we will set the alignment of last paragraph element to the right by using CSS property. To set the alignment of last paragraph to right, we use CSS text-align-last property.

The text-align-last is used to set the last line of the paragraph just before the line break. The line break may be due to the natural ending of a paragraph, or it may be due to the use of <br> tag. The text-align-last property sets the alignment of all the last lines occurring in the element in which the text-align-last property is applied. For example, if the text-align-last property is applied to the <p> element then, all the last lines of the <p> element will be affected by the text-align-last property.


text-align-last: right



<!DOCTYPE html>
<html lang="en">
        How to align last line of a
        paragraph element to the
        right using CSS?
        h1 {
            color: green;
        p {
            text-align: justify;
            -moz-text-align-last: right;
            text-align-last: right;
        How to align last line of a
        paragraph <br>element to the
        right using CSS?
        Cascading Style Sheets, fondly referred
        to as CSS, is a simply designed language
        intended to simplify the process of making
        web pages presentable. CSS allows you to
        apply styles to web pages. More importantly,
        CSS enables you to do this independent of
        the HTML that makes up each web page.


Supported Browsers: The browser supported by text-align-last property are listed below:

  • Google Chrome 47.0
  • Internet Explorer 5.5
  • Firefox 49.0, 12.0 -moz-
  • Opera 34.0

Last Updated : 30 Dec, 2020
Like Article
Save Article
Similar Reads
Related Tutorials