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

cdT*_*est 10 html css twitter-bootstrap twitter-bootstrap-4 bootstrap-4

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>
Run Code Online (Sandbox Code Playgroud)

Pau*_*e_D 11

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

Bootstrap 4迁移文档

.dl-horizontal已被丢弃.相反,使用.row<dl>和其使用网格列类(或混入)<dt><dd>子女.


Bel*_*ash 11

我遇到了同样的问题,并使用.row@Paulie_D建议的类解决了它

这是我所做的

 <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>
Run Code Online (Sandbox Code Playgroud)


sig*_*mon 7

如果您已嵌入.dl-horizontal内容,则始终可以将 Bootstrap 3 代码重新添加到您自己的.css样式表中。从Bootstrap 3 来源

@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;
}

Run Code Online (Sandbox Code Playgroud)