After word break, align next line to the left rather than center

R3C0Nx00 picture R3C0Nx00 · Sep 10, 2018 · Viewed 12.2k times · Source

I am styling my paragraphs and I have line break after a certain amount of characters. I want to be able to make the line after the break to be aligned left rather than center.

Answer

Paulie_D picture Paulie_D · Sep 10, 2018

You can use text-align-last

The text-align-last CSS property describes how the last line of a block or a line, right before a forced line break, is aligned.

MDN

.justify {
  text-align: justify;
  text-justify: inter-word;
}

.paragraph {
  text-align: center;
  max-width: 220px;
  word-wrap: break-word;
  word-break: break-all;
  text-align-last: left;
  border: 1px solid red;
}
<div class='justify'>
  <p class="paragraph">Hello, my name is Taylor and welcome to my personal website!</p>
</div>