dl list view在bootstrap 4中不起作用,与bootstrap 3中的相同
HTML:
<section class="landing">
<div class="container">
<dl class="dl-horizontal">
<dt>col1</dt>
<dd>col2</dd>
</dl>
</div>
</section>
答案 0 :(得分:7)
该类已从V4中的Bootstrap中删除。
来自Migration documents of Bootstrap 4
.dl-horizontal
已被删除。相反,请在.row
上使用<dl>
,并在其<dt>
和<dd>
子项上使用网格列类(或mixins)。
答案 1 :(得分:5)
我遇到了同样的问题,并使用{Paulie_D建议的.row
类解决了这个问题
这就是我所做的
<section class="landing">
<div class="container">
<dl class="row">
<dt class="col-sm-3">col1</dt>
<dd class="col-sm-9">col2</dd>
</dl>
</div>
</section>
答案 2 :(得分:1)
如果您将.dl-horizontal
嵌入内容中,则始终可以将Bootstrap 3代码重新添加到自己的.css
样式表中。来自Bootstrap 3 source:
@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
clear: left;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dl-horizontal dd {
margin-left: 180px;
}
}
...
.dl-horizontal dd:before,
.dl-horizontal dd:after, {
display: table;
content: " ";
}
...
.dl-horizontal dd:after {
clear: both;
}