将glyphicon按钮添加到list-group-item的一侧

时间:2017-08-21 18:47:17

标签: html bootstrap-4

给定标准bootstrap list-group-item:

var

在list-group-item内右侧添加删除图标的最佳方法是什么?浮动破坏了div的造型。 这是我要添加的按钮:

        <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>

我是一个新的引导程序我尝试在列表组项目中创建列,但结果也很差。

2 个答案:

答案 0 :(得分: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>

答案 1 :(得分:0)

使用css属性:

display: inline-block

它将解决问题。