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
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.
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.
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.
just add text-left
class
<input type="button" value="Applicant/Subsidiary" id="mybutton" name="test" class="primary-btn col-xs-11 text-left">
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.
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With