Css 显示表格在页边距顶部占用额外空间

Css 显示表格在页边距顶部占用额外空间,css,twitter-bootstrap-3,Css,Twitter Bootstrap 3,我试图创建一个类似于引导中输入组的组件。我没有使用引导的默认输入组类的原因是,默认情况下,我无法在输入组插件中添加多个按钮和输入元素。所以我决定使用DisplayTable属性创建自定义输入组,但当我使用该属性时,会在按钮部分的顶部添加一些额外的空间 我需要在同一行中对齐输入和计数器组件 HTML部分 这是我的这里有两个问题: .product order form将高度设置为30px,这意味着它比它的一些子项/兄弟项短。这会导致问题,请尝试添加溢出:hidden以查看其运行情况 .tableC

我试图创建一个类似于引导中输入组的组件。我没有使用引导的默认输入组类的原因是,默认情况下,我无法在输入组插件中添加多个按钮和输入元素。所以我决定使用DisplayTable属性创建自定义输入组,但当我使用该属性时,会在按钮部分的顶部添加一些额外的空间

我需要在同一行中对齐输入和计数器组件

HTML部分


这是我的

这里有两个问题:

.product order form将高度设置为30px,这意味着它比它的一些子项/兄弟项短。这会导致问题,请尝试添加溢出:hidden以查看其运行情况 .tableCell没有垂直对齐,这意味着它将自身定位在顶部o/t组件上。尝试添加垂直对齐:中间,它应该可以正常工作 TL;博士


应该这样做:

请在问题中添加代码。在这种情况下,外部链接是不可接受的。我在问题中添加了html和css。
 <div class="product-order-form" matAutocompleteOrigin #origin="matAutocompleteOrigin">
    <div class="product-inputGroup tableElem">
        <div class="tableRow">
            <input class="form-control tableCell" type="text" matInput [formControl]="myControl" [matAutocomplete]="auto" [matAutocompleteConnectedTo]="origin">
            <div class="counter tableCell">
                <div class="counterContainer">
                    <div class="value-button" id="decrease" value="Decrease Value">-</div>
                    <input type="text" id="number" value="0" />
                    <div class="value-button" id="increase" value="Increase Value">+</div>
                </div>


            </div>
        </div>


    </div>
 </div>
.tableElem{
  display:table;
  width:100%;
}

.tableRow{
  display:table-row;
  width:100%;
}
.tableCell{
  display:table-cell;
}

.product-order-form{
  height: 30px;
}
.counterContainer {
  width: 150px;
  height:30px;  
}

.value-button{
    text-align: center;
    height: 100%;
    width: 50px;
    background: lightgray;
    padding: 5px;
    box-sizing: border-box;
    float: left;
}

.value-button:hover {
  cursor: pointer;
}



input#number{
    text-align: center;
    height: 100%;
    border: none;
    width: 50px;   
    float: left;   
    box-sizing: border-box;
    border-top: 0.5px solid lightgray;
    border-bottom: 0.5px solid lightgray;
}

.tableCell[_ngcontent-c2] {
    display: table-cell;
    vertical-align: middle;
}
.product-order-form[_ngcontent-c2]{
  height: auto;
}