Bootstrap

Justify Text Bootstrap With Code Examples

Bootstrap classes have predefined CSS styling. These classes are added to the elements you want to apply styles. The text justification in Bootstrap is an important aspect of web design. It helps to align text on a web page and enhances the appearance of a web page. More specifically, the Bootstrap “text-justify” class is utilized to justify the text.

This write-up will describe:

How to Justify Text Using Bootstrap?

The “text-justify” class is utilized to justify the text. This class has a predefined CSS “text-align” property having the value “justify”.

Check out the example to see how to add the “text-justify” class to the HTML elements.

Example

In HTML, add the “<p>” element with the class “text-justify” to include some text content to the web page:

<p class="text-justify">
 Linuxhint is the best online tutorial website. It provides quality articles and video lectures to educate the world. </p>

 
Output

How to Justify Text Using CSS?

The CSS “text-align” property having the value “justify” is utilized to justify the text. The following CSS example demonstrates text justification.

Example

In HTML, add a “<p>” element with some text content:

<p>Linuxhint is the best online tutorial website. It provides quality articles and video lectures to educate the world.</p>

 
CSS

p {
 text-align: justify;
}

 
In CSS, add the “text-align” property with the value “justify” to the “p” element.

Output


It can be observed that the alignment of the text has been set as justified.

Conclusion

In Bootstrap, the “text-justify” class is utilized to justify the text content on the web page. This class has a predefined CSS “text-align” property with the value set as “justify”. You can add the “text-justify” class to the element that contains the text. This write-up has explained how to justify the text using Bootstrap.

About the author

Nadia Bano

I am an enthusiastic and forward-looking software engineer with an aim to explore the global software industry. I love to write articles on advanced-level designing, coding, and testing.