html - Bootstrap CSS Align Text Middle Div -
i have bootstrap row 3 columns. in middle column, there input field increasing height of row , throwing aligning text in first div @ top.
i tried adding css align div text in middle wasn't working.
.filteroption{ display: table-cell; vertical-align: middle; }
my html basic , looks so:
if(field.isinput == '1'){ output += '<div class="row">' + '<div class="col-md-2 filteroption">'+field.fieldname+'</div>' + '<div class="col-md-9"><input type="text" class="form-control" id="field_'+field.fieldid+'" name="field_'+field.fieldid+'" placeholder="'+field.placeholder+'"></div>' + '<div class="col-md-1"><button type="button" class="btn btn-danger btn-sm pull-right"><i class="fa fa-remove"></i></button></div>' + '</div>'; }
the question
how can go getting label / content in first div aligned in middle?
you may use translatey:
.filteroption{ position:relative; transform: translatey(30%); text-align: center; }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <div class="row"> <div class="col-md-2 filteroption">'+field.fieldname+'</div> <div class="col-md-9"><input type="text" class="form-control" id="field_'+field.fieldid+'" name="field_'+field.fieldid+'" placeholder="'+field.placeholder+'"></div> <div class="col-md-1"> <button type="button" class="btn btn-danger btn-sm pull-right"><i class="fa fa-remove"></i></button> </div> </div>
Comments
Post a Comment