Visual Studio 2017; ASP.NET核心MVC;剃刀;自举
这是我的cshtml-file
:
<table class="table table-striped table-bordered">
<colgroup>
<col />
<col style="width:auto; white-space:nowrap" />
</colgroup>
<tbody>
@foreach (var item in Model) {
<tr>
<td style="vertical-align:central">@item.TemplateName</td>
<td>
<div class="btn-group pull-right">
<a class="btn btn-default" href="#" title="Редактировать">
<span class="glyphicon glyphicon-edit"
aria-hidden="true"></span>
</a>
<a class="btn btn-default" href="#" title="Копировать">
<span class="glyphicon glyphicon-plus-sign"
aria-hidden="true"></span>
</a>
<a class="btn btn-default" href="#" title="Удалить">
<span class="glyphicon glyphicon-remove"
aria-hidden="true"></span>
</a>
</div>
</td>
</tr>
}
</tbody>
</table>
结果与我的预期不一样:
我需要第一列的内容垂直居中。另外我需要根据其内容拟合第二列宽度。
我怎样才能得到它?
答案 0 :(得分:0)
vertical-align:middle //align vertically middle
<td style="width:1%;white-space:nowrap">
<div class="btn-group pull-right" style="width: auto;min-width: 120px;">
//to fit column width according to its content.