twitter-bootstrap 使用 Bootstrap v4 将按钮对齐到“卡片”的右侧

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33596896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 23:19:50  来源:igfitidea点击:

Aligning button to the right of a 'card' using Bootstrap v4

htmlcsstwitter-bootstraptwitter-bootstrap-4bootstrap-4

提问by Michael LB

I'm new to Bootstrap and thought I'd dive in using their v4 alpha release.

我是 Bootstrap 的新手,我想我会深入使用他们的 v4 alpha 版本。

I'm trying to align the 'Arrange a valuation' button (near to bottom of page) in the following example to the right whilst leaving the other text aligned to the left. I also need the text and button to be vertically aligned in the middle.

我正在尝试将以下示例中的“安排估价”按钮(靠近页面底部)向右对齐,同时将其他文本向左对齐。我还需要文本和按钮在中间垂直对齐。

http://www.atlasestateagents.co.uk/mlb/landlords/services-and-fees.php

http://www.atlasestateagents.co.uk/mlb/landlords/services-and-fees.php

Can you help?

你能帮我吗?

<div class="card card-block card-blue clearfix">
    <p class="card-text">Want to know how much rent you could achieve for your property?&nbsp;<a href="#" class="btn btn-blue-outline pull-right">Arrange a Valuation</a></p>
  </div>

回答by Zim

In the latest Bootstrap 4 (alpha 6) pull-rightis now float-right:

在最新的 Bootstrap 4(alpha 6)pull-rightfloat-right

<div class="card card-block card-outline-primary">
    <p class="card-text">Want to know how much rent you could achieve for your property? &nbsp;
        <a href="#" class="btn btn-outline-primary float-right">Arrange a Valuation</a>
     </p>
</div>

http://www.codeply.com/go/D2i7JWqv4d

http://www.codeply.com/go/D2i7JWqv4d

回答by Christian Colón

Add .pull-rightto the a tag's class.

添加.pull-right到 a 标签的类。

<div class="card card-block card-primary">
    <p class="card-text">Want to know how much rent you could achieve for your property?&nbsp;<a href="#" class="btn btn-primary-outline pull-right">Arrange a Valuation</a></p>
</div>