Home > Software design >  How to justify a paragraph except the last line in CSS or HTML
How to justify a paragraph except the last line in CSS or HTML

Time:10-03

Is there a CSS or HTML way to justify a whole paragraph, but the last line of the paragraph can be aligned to the center, to the left, or to the right?

CodePudding user response:

You are looking for text-align-last.

p {
  text-align: justify;
  text-align-last: right;
}
<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
  in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>

  • Related