How to avoid space on the right side of a line in HTML?

54 views Asked by At

The right endings of each line should align perfectly like the left ends, instead of the case above. Help!

3

There are 3 answers

0
andreas On BEST ANSWER

You can simply use text-align: justify:

div {
  width: 300px;
  text-align: justify;
}
<div>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
  sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
  Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</div>

See MDN for more information.

0
Ionică Bizău On

Use text-align: justify. This will make the lines full width.

0
Wais Kamal On

Select the parent element in CSS. For example if this is the parent element:

<p id="text-container"> Your text... </p>

Then:

#text-container {
  text-align: justify;
}

will do you the job.