Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap setting height for btn-block buttons

My code looks like this:

<div class="row">
  <div class="col-xs-4">
    <a class="btn btn-default btn-block" href="#">1</a>
  </div>
  <div class="col-xs-4">
    <a class="btn btn-default btn-block" href="#">2</a>
  </div>
  <div class="col-xs-4">
      <a class="btn btn-default btn-block" href="#">3</a>
  </div>
</div>

This gives me 3 buttons across which is what I want. What I would like to do is make the buttons taller. If at all possible I'd prefer not to specify heights in pixels so that it can scale to different screen sizes better. Could I perhaps specify the height as a ratio (of the width) or a percentage of screen height?

Thanks in advance.

like image 903
comphelp Avatar asked Aug 07 '14 04:08

comphelp


People also ask

How do I change the height of a button in Bootstrap?

You can very easily change button size by adding btn-lg or btn-sm class to it. These classes modify the button's padding and also the font size and the CSS border radius.

How do I make Bootstrap buttons the same size?

How do I get my bootstrap buttons the same size or width ? Use btn-block, (other optional elements below are: btn-lg for large and btn-primary for blue primary buttons. Use col-sm-4 for narrow and col-sm-12 or entire row for full length buttons.

How do I block a button in Bootstrap?

Use the . disabled class in Bootstrap to disable a button.


1 Answers

The simple & best solution would be to add top and bottom padding.

.btn-block {
    padding: 10% 0; 
    /* define values in pixels / Percentage or em. whatever suits 
       your requirements */
}
like image 195
Nishant Avatar answered Oct 14 '22 05:10

Nishant