dl(详细列表)在bootstrap 4中不起作用

问题描述 投票:8回答:3

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>
html css twitter-bootstrap twitter-bootstrap-4 bootstrap-4
3个回答
9
投票

该类已从V4中的Bootstrap中删除。

来自Migration documents of Bootstrap 4

.dl-horizontal已被撤销。相反,在.row上使用<dl>并在其<dt><dd>儿童上使用网格列类(或mixins)。


8
投票

我有同样的问题,并使用@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
投票

如果你在内容中嵌入了.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;
}

© www.soinside.com 2019 - 2024. All rights reserved.