简体   繁体   中英

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: 当前

And I need them like this: 期望

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM