Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap buttons with same height and vertically-centered text

I have 3 Bootstrap buttons side-by-side, but one of them has a line break (I'm modifying them with white-space: normal). I need them all to have the same height, and vertical-centered text.

I have them like this: current

And I need them like this: desired

I can't figure out how to do this. Any ideas?

like image 456
so4t Avatar asked Jun 26 '15 18:06

so4t


People also ask

Can button group be made to appear vertically stacked in Bootstrap?

Use the . btn-group-vertical class in Bootstrap to make a button group appear vertically stacked.

Can you customize Bootstrap buttons?

Because of its framework, Bootstrap's buttons are already styled when they're added to the site. However, if you want to create your own custom button style, you can do that in Bootstrap's CSS file.


1 Answers

would something like this work for you?

.option-button {
    height:100%;
}

.media-object {
    height: 100px;
}
<br/><br/>
<div class="media-object pull-left">
    <button class="btn btn-info option-button">A</button>
    <button class="btn btn-primary option-button">A<br/>B<br/>C</button>
    <button class="btn btn-info option-button">A</button>
</div>            

<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>

you can use height: 100%; on the buttons but with that, you need to set the height of the containing div. hope this helps!

like image 78
indubitablee Avatar answered Oct 18 '22 04:10

indubitablee