Languages
[Edit]
EN

CSS - text align justify

0 points
Created by:
Marley-Marks
712

In this article, we would like to show you how to align text to the justify using CSS.

Quick solution:

.element {
  	text-align: justify;
}

 

Practical example

In this example, we create a style for  .element class that uses text-align property to justify the text inside div element.   

// ONLINE-RUNNER:browser;

<!doctype>
<html>
<head>
  <style>

    .element {
      	text-align: justify;  /*  <---------- required   */
        border: 1px solid lightgray;
    }

  </style>
</head>
<body>
  <div class="element">Some long text inside the div element...</div>
  <br />
  <div class="element">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
</body>
</html>

 

See also

  1. CSS - text align left

  2. CSS - text align right

  3. CSS - text align center

References

  1. text-align - CSS: Cascading Style Sheets | MDN
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join