How to center-justify the last line of text in CSS?

You can use the text-align-last property

.center-justified {
    text-align: justify;
    text-align-last: center;

Here is a compatibility table:

Works in all browsers except for Safari (both Mac and iOS), including Internet Explorer. As of 12.09.2022, Safari 16 supports this feature, as mentioned in the compatibility table.

Also in Internet Explorer, only works with text-align: justify (no other values of text-align) and start and end are not supported.

Leave a Comment