【问题标题】:Align left dl-horizontal, dt, and dd左对齐 dl-水平、dt 和 dd
【发布时间】:2016-05-31 13:37:52
【问题描述】:

我在面板内工作,无法左对齐或删除 Bootstrap 中水平列表的边距。

<div class="container">
  <div class="panel panel-primary">
    <div class="panel-heading">
      <h3 class="panel-title">
        <strong>testing</strong>
      </h3>
    </div>
    <div class="panel-body">
      <dl class="dl-horizontal">
        <dt>term 1</dt>
        <dd>foo</dd>
        <dt>term 2</dt>
        <dd>bar</dd>
      </dl>
    </div>
  </div>
</div>

https://jsfiddle.net/srzyL86g/

【问题讨论】:

    标签: css twitter-bootstrap twitter-bootstrap-3 text-align


    【解决方案1】:

    在这里解决。 https://jsfiddle.net/adityap708/9k0qg8jn/

    .container dt,.container dd {
      width:auto;
      margin-left:auto;
      display:inline-block;
    }
    

    将此添加到您的 CSS。 Boostrap 给 dtdd widthmargin 你需要覆盖它。

    【讨论】:

    • 谢谢!这确实解决了它。我是 web 开发的新手,所以想知道为什么需要领先的 .container?我尝试只用 dt、dd 覆盖左边距和宽度,但它不起作用。
    • 您必须将!important 添加到每个属性
    • 因为 bootstrap 已经将样式直接添加到这些标签中。
    • 感谢您的帮助!
    • @user16666322 很高兴。
    猜你喜欢
    • 2020-09-06
    • 1970-01-01
    • 2011-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-19
    • 2018-11-26
    • 1970-01-01
    相关资源
    最近更新 更多