数据表中的下拉列表不会垂直对齐

Dropdown within datatables won't vertically align

我在动态创建的数据tables table 中有一个下拉列表 - 我修改了 bootstrap css 以便 table 设置为 middle 但下拉列表仍显示为 top

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td
{
  padding: 8px;
  line-height: 1.42857143;
  vertical-align: middle;
  border-top: 1px solid #ddd;
}

查看我的jsbin here

(如果您输入任何文本,然后 添加说明 然后单击 加载复制的数据 按钮)

非常感谢

Update: 父 div 上的 form-group class 具有设置: 底部边距: 15px

我创建了一个新的 class 来覆盖该设置 margin-bottom 为 0px

它实际上并没有对齐顶部。父 div 只是有一个 Bootstrap CSS:

.form-group {
    margin-bottom: 15px;
}

你的 select 父级 div 有一个 .form-group class,其样式为 margin-bottom :15px;

您可以在 css 中将 margin-top:15px; 添加到 .form-group 或设置 边距:0px;

在你的 css select.input-xs 中添加 margin-top: 15px; 就可以了对齐您的下拉菜单。