Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to justify text within the bootstrap framework?

This might be a silly question but I'm certain I'm not the only one wondering.

I'm aware of the alignment classes: <p class="text-center">Text Centered within the block element</p> <p class="text-right">Text aligned to the right within the block element</p> <p class="text-left">Text aligned to the left within the block element</p>

Is there a set of classes in Twitters Bootstrap Framework that justifies text?

e.g. <p class="text-justify">Sample Text Goes Here</p>

why does it appear that bootstrap do not incorporate a utility function such as text-align: justify?

like image 333
scriptmonkey Avatar asked Oct 02 '13 18:10

scriptmonkey


People also ask

How do you justify text in bootstrap?

The text can justified by using the . text-justify class and for left, right, and center alignment of text, use the text-left, text-right and text-center classes respectively.

How do you justify text in HTML?

In order to suggest that some text be justified on both sides, you can use the align="justify" attribute in HTML, or the text-align:justify declaration in CSS, or both.


2 Answers

In Bootstrap 3 and Bootstrap 4 you can use the following:

<p class="text-justify">Justified text.</p> 

Official documentation

(Update) This feature removed from Bootstrap 5

  • Commit
  • Official document and recommendation

Note that we don't provide utility classes for justified text. While, aesthetically, justified text might look more appealing, it does make word-spacing more random and therefore harder to read.

Based on the official UX suggestion: don't use justified text! ;)

like image 132
Zoltan Avatar answered Sep 22 '22 11:09

Zoltan


No. But you can add a new class on bootstrap.css

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

Update

Previous versions of bootstrap was not supporting text-justify. But bootstrap 3 has added a class text-justify.

like image 39
Flavio Paulino Avatar answered Sep 20 '22 11:09

Flavio Paulino