Bootstrap - 将Div修复到div的底部

时间:2018-02-09 04:20:08

标签: css bootstrap-4

我有一个div,在那个div中,我有另一个div。我试图使用专门的bootstrap类将内部div固定到外部div的底部,但我似乎无法找到一个bootstrap方法来执行此操作。我也尝试过使用普通的CSS,但是无法使用它。我试过veritical-align:bottom;并将位置设置为绝对值。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="card-body">
  <ul class="list-unstyled mt-3 mb-4" style="text-align: left;">
    <li>stuff</li>
  </ul>
  <div>
    <button type="button" class="btn btn-outline-primary">Edit</button>
    <button type="button" class="btn btn-outline-primary">Delete</button>
  </div>
</div>

2 个答案:

答案 0 :(得分:0)

这是你想要实现的目标吗?

&#13;
&#13;
.card-body {
  border: 4px solid blue;
  position: relative;
}

.inner {
  border: 4px solid red;
  position: absolute;
  bottom: -50px;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="card-body">
  <ul class="list-unstyled mt-3 mb-4" style="text-align: left;">
    <li>stuff</li>
  </ul>
  <div class="inner">
    <button type="button" class="btn btn-outline-primary">Edit</button>
    <button type="button" class="btn btn-outline-primary">Delete</button>
  </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

要使用Bootstrap 4类完成它,只需将类CSV.open("conversations_#{mailbox_id}.csv", "wb", col_sep: ';', headers: true, force_quotes: false) do |csv| csv << ["Number", "From", "Subject", "Created", "Message"] conversations.each do |conversation| customer = conversation.customer threaded_conversation = helpscout.conversation(conversation.id) sleep(0.3) customer_message = begin body_message = threaded_conversation.threads.last.body rescue body_message = 'exception' end csv << [conversation.number, customer.email, conversation.subject, conversation.createdAt, customer_message] end end 添加到d-flex flex-column,然后将card-body类(margin-top:auto)添加到内部div像这样:

mt-auto

这将始终将内部div固定在底部。