Bootstrap table : input and button don't have the same height in TD

Viewed 347

In a table TD, I want to display an input and a button.

My problem is that the two components doesn't seem to have the same height, how can I fix this?

Thanks.

 <td  class="text-center col-md-1" data-title="'Compte'"  align="center" >
        <div class="col-md-12">
            <input value="999"
                   style="width: 70%; text-align: center;"
                   ng-disabled="true" class="col-md-10 form-control" />
            <button type="button"
                    ng-click="vm.openListeCompteDialog(sortie)"
                    class="btn btn-info btn-sm">
                <span class="glyphicon glyphicon-list"></span>
                <span class="hidden-xs hidden-sm"></span>
            </button>
        </div>
    
    </td>

enter image description here

2 Answers

remove class .btn-sm from your

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="row">
<td  class="text-center col-md-1" data-title="'Compte'"  align="center" >
    <div class="col-md-12">
        <input value="999"
               style="width: 70%; text-align: center;"
               ng-disabled="true" class="col-md-10 form-control" />
        <button type="button"
                ng-click="vm.openListeCompteDialog(sortie)"
                class="btn btn-info">
            <span class="glyphicon glyphicon-list"></span>
            <span class="hidden-xs hidden-sm"></span>
        </button>
    </div>

</td>
</div>
</body>
</html>

Well from what I see you didnt set height for the parent of input and button. Here is my solution

<td  class="text-center col-md-1" data-title="'Compte'"  align="center" >
    <div class="col-md-12" style="height: 100px;">
        <input value="999"
               style="text-align: center; height: 100%"
               ng-disabled="true" class="col-md-10 form-control"/>
        <button type="button"
                ng-click="vm.openListeCompteDialog(sortie)"
                class="btn btn-info btn-sm" style="height: 100%" >
            <span class="glyphicon glyphicon-list"></span>
            <span class="hidden-xs hidden-sm"></span>
        </button>
    </div>

</td>

Related