Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making button go full-width?

I want a button to take up the full width of the column, but having difficulties...

<div class="span9 btn-block">     <button class="btn btn-large btn-block btn-primary" type="button">Block level button</button> </div> 

How do I make the button as wide as the column?

like image 353
user1438003 Avatar asked Aug 21 '12 18:08

user1438003


People also ask

How do you make a button full width?

Creating a full-width button is very simple and easy, just take an <button> element and make it a block element with display: block property and add width: 100% to it.

How can set full width button in bootstrap?

Add .btn-lg or .btn-sm for additional sizes. Create block level buttons—those that span the full width of a parent—by adding .btn-block .

How do you make a button bigger in CSS?

To increase the height and width of a button, use padding, and then overwrite default value buttons like border and background if you wish by overwriteing the appropriate border values as well as the applicable background values.In addition, to make buttons responsive, you can add a percentage to the width value.

How do I force a div to full width?

The width property is used to fill a div remaining horizontal space using CSS. By setting the width to 100% it takes the whole width available of its parent. Example 1: This example use width property to fill the horizontal space. It set width to 100% to fill it completely.


2 Answers

Bootstrap v3 & v4

Use btn-block class on your button/element

Bootstrap v2

Use input-block-level class on your button/element

like image 92
Layke Avatar answered Oct 24 '22 16:10

Layke


Why not use the Bootstrap predefined class input-block-level that does the job?

<a href="#" class="btn input-block-level">Full-Width Button</a> <!-- BS2 --> <a href="#" class="btn form-control">Full-Width Button</a> <!-- BS3 -->  <!-- And let's join both for BS# :) --> <a href="#" class="btn input-block-level form-control">Full-Width Button</a> 

Learn more here in the Control Sizing^ section.

like image 38
CodeAngry Avatar answered Oct 24 '22 16:10

CodeAngry