0

Hello i need to align the content of the column to the center vertically. This is the image of my form

Bootstrap form

And code:

<div class="row">
    <div class="form-group col-lg-2">
            <label translate="global.field.name" for="name">Name</label>
            <input type="text" class="form-control" />
    </div>
    <div class="form-group col-lg-2">
            <label translate="global.field.code" for="code">Code</label>
            <input type="text" class="form-control" />
    </div>
    <div class="form-group col-lg-2">
            <label translate="global.field.translation" for="translation">Translation</label>
            <input type="text" class="form-control" />
    </div>
    <div class="form-group col" >
            <button><span class="glyphicon glyphicon-remove"></span></button>
            <button><span class="glyphicon glyphicon-search"></span></button>
    </div>

How to align the last column to the center vertically?

Vítor Nóbrega
  • 1,219
  • 4
  • 26
  • 53

2 Answers2

1

You could use flexbox like this..

.vcenter {
    display: flex;
    align-items: center;
}

<div class="row vcenter">
    <div class="form-group col-lg-2">
            <label translate="global.field.name" for="name">Name</label>
            <input type="text" class="form-control" />
    </div>
    <div class="form-group col-lg-2">
            <label translate="global.field.code" for="code">Code</label>
            <input type="text" class="form-control" />
    </div>
    <div class="form-group col-lg-2">
            <label translate="global.field.translation" for="translation">Translation</label>
            <input type="text" class="form-control" />
    </div>
    <div class="form-group col-lg-1" >
            <button class="btn btn-default"><span class="glyphicon glyphicon-remove"></span></button>
            <button class="btn btn-default"><span class=" glyphicon glyphicon-search"></span></button>
    </div>
 </div>

http://codeply.com/go/Ak9iMhZAuH

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
0

Add this to the div you want to align:

.vcenter {
display: inline-block;
vertical-align: middle;
float: none;}
uksz
  • 18,239
  • 30
  • 94
  • 161