Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertically middle align button in bootstrap column

I want to vertically middle align the buttons in bootstrap columns.

Fiddler: https://jsfiddle.net/ebwwvy6m/23/

HTML

<div class="row">
   <div class="col-sm-3 vcenter">                   
      <button type="button" class="btn btn-success btn-sm" id="BtnExport">Export</button>
    </div>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-sm-6">
                            Comment
                            <textarea rows="2" class="form-control" id="TextAreaComment"></textarea>
                        </div>
                        <div class="col-sm-6 vcenter">
                            <button type="button" class="btn btn-primary btn-sm" id="BtnEntry">Abandon</button>
                        </div>
                    </div>
                </div>
            </div>

CSS:

.vcenter {
    display:inline-block !important;
    vertical-align:middle !important;   
}

Expectation:

enter image description here

What I tried?

I tried following the solutions provided here,

  1. Vertical align button in the middle of the column- bootstrap
  2. Vertical align button middle next to text
  3. Bootstrap - Vertically Align Button With Well

But, I am not getting the solution. Any suggestion will be much appreciated. Thanks.

like image 214
JGV Avatar asked Dec 01 '16 18:12

JGV


1 Answers

.align-self-center will work.

<div class="col-sm-6 align-self-center">

</div>
like image 182
George Livingston Avatar answered Oct 13 '22 23:10

George Livingston