【问题标题】:Adding a glyphicon button to the side of a list-group-item在 list-group-item 的一侧添加一个 glyphicon 按钮
【发布时间】:2017-08-22 03:00:50
【问题描述】:

给定标准引导列表组项:

        <div class="list-group-item list-group-item-action flex-column align-items-start">
          <div class="d-flex w-100 justify-content-between">
            <h5 class="mb-1">List group item heading</h5>
            <small class="text-muted">3 days ago</small>
          </div>
          <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
          <small class="text-muted">Donec id elit non mi porta.</small>
        </div>

将删除图标添加到列表组项内右侧的最佳方法是什么? float 破坏了 div 的样式。 这是我要添加的按钮:

<button type="button" class="btn btn-danger btn-lg"><span class='glyphicon glyphicon-remove'></span></button>

我对引导程序有点陌生,我尝试在列表组项中创建列,但结果也很差。

【问题讨论】:

    标签: html bootstrap-4


    【解决方案1】:

    这个使用 span 的代码对我有用,虽然我不喜欢图标绑定到标题垂直位置,即使在这个用例中它并不重要。

              <div class="d-flex w-100 justify-content-between">
                <h5 class="mb-1">List group item heading</h5>
                <span class="pull-right">
                  <span class="btn btn-lrg btn-danger" onclick="">
                      <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                  </span>
              </span>
                <small class="text-muted">3 days ago</small>
              </div>
              <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
              <small class="text-muted">Donec id elit non mi porta.</small>
            </div>
    

    【讨论】:

      【解决方案2】:

      使用css属性:

      display: inline-block
      

      它会解决问题。

      【讨论】:

      • 对不起,我应该在哪个 dom 上使用那个?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多