Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap : align button text left

How can I align text to the left within a bootstrap button? I have multiple buttons with text of varying length, and all the button need to have same width. I have achieved this using the class col-xs-11.

Sample button code below:

<input type="button" value="Applicant/Subsidiary" id="mybutton" name="test" class="primary-btn col-xs-11"> 

Is it possible to achieve this without creating a custom style, other than what is provided by bootstrap? I'm using Bootstrap v3.0.1

like image 649
Delon Avatar asked Oct 31 '14 12:10

Delon


People also ask

How do I move a button from right to left in Bootstrap?

Answer: Use the text-right Classtext-right on the containing element to right align your Bootstrap buttons within a block box or grid column. It will work in both Bootstrap 3 and 4 versions.

How do I align a text button?

We can align the buttons horizontally as well as vertically. We can center the button by using the following methods: text-align: center - By setting the value of text-align property of parent div tag to the center. margin: auto - By setting the value of margin property to auto.

How do I center text in a Bootstrap button?

Answer: Use the text-center Class You can simply use the built-in class . text-center on the wrapper element to center align buttons or other inline elements in Bootstrap.


2 Answers

just add text-left class

<input type="button" value="Applicant/Subsidiary" id="mybutton" name="test" class="primary-btn col-xs-11 text-left"> 
like image 124
Sasa Avatar answered Oct 08 '22 22:10

Sasa


The issue is not how to css text-align to the left, the original post was asking if there is a bootstrap class name(s) works for it.

The .text-left works, but the trouble is there is a .btn that is stronger than text-left, I think this is something bootstrap need to think about.

Checkout this screenshot that I did a test with Chrome inspect on Bootstrap's site. enter image description here

In my Chrome, I add "text-left" on the demo button, and this is the result. Therefore, have !important on it!

.text-left {   text-align: left !important; } 
like image 41
bard Avatar answered Oct 09 '22 00:10

bard