Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed width buttons with Bootstrap

Does Bootstrap support fixed width buttons? Currently if I have 2 buttons, "Save" and "Download", the button size changes based on content.

Also what is the right way of extending Bootstrap?

like image 813
aWebDeveloper Avatar asked Jun 15 '12 12:06

aWebDeveloper


People also ask

How do you make a button width the same as a div?

The process for the algorithm would be: get the width of the div, put into a variable. divide the width by the number of buttons and put that answer into a variable. run a function that creates a button at that width by however many times required.

How do I keep the space between two buttons in Bootstrap?

Add an Empty div Element Between Two Buttons to Add Space Between Them in HTML. Use the margin-right Property to Put Space Between the Buttons in HTML.


1 Answers

You can also use the .btn-block class on the button, so that it expands to the parent's width.

If the parent is a fixed width element the button will expand to take all width. You can apply existing markup to the container to ensure fixed/fluid buttons take up only the required space.

<div class="span2">     <p><button class="btn btn-primary btn-block">Save</button></p>     <p><button class="btn btn-success btn-block">Download</button></p> </div> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />   <div class="span2">   <p><button class="btn btn-primary btn-block">Save</button></p>   <p><button class="btn btn-success btn-block">Download</button></p> </div>
like image 96
Kami Avatar answered Sep 20 '22 15:09

Kami