Bootstrap 4,在两个卡片组之间增加空间

时间:2017-04-03 16:26:23

标签: css twitter-bootstrap bootstrap-4 twitter-bootstrap-4

我正在尝试在两个卡片组之间添加空间。我正在使用bootstrap 4 alpha 6.我不知道为什么在第二张卡牌上使用mt-20不会这样做。我已经尝试将它们包装成行并执行它,但是也没有这样做:

enter image description here

<div>
<div class="container">
            <div class="card-deck">
                <div class="card text-center">
                    <div class="card-block">
                        <h4 class="card-title">Permits</h4>
                        <p class="card-text">
                            Apply for parking permit<br />
                            View existing permit requests<br />
                            Activate Visitor permits<br />
                        </p>
                    </div>
                    <div class="card-footer">
                        @Html.ActionLink("Permits", "Index", "Home", new { Area = "Permit" }, new { @class = "btn btn-primary" })
                    </div>
                </div>

                <div class="card text-center">
                    <div class="card-block">
                        <h4 class="card-title">Vehicles</h4>
                        <p class="card-text">
                            View and manage your vehicles
                        </p>
                    </div>
                    <div class="card-footer">
                        @Html.ActionLink("My Vehicles", "Index", "Vehicle", null, new { @class = "btn btn-primary" })
                    </div>
                </div>

                <div class="card text-center">
                    <div class="card-block">
                        <h4 class="card-title">Parking Tickets</h4>
                        <p class="card-text">
                            View your parking ticket history
                        </p>
                    </div>
                    <div class="card-footer">
                        @Html.ActionLink("My Tickets", "Index", "ParkingTicket", null, new { @class = "btn btn-primary" })
                    </div>
                </div>
            </div>
    <div class="card-deck mt-20">
        <div class="card text-center">
            <div class="card-block">
                <h4 class="card-title">Funding Options</h4>
                <p class="card-text">
                    Add credit/debit card<br />
                    Top up Account<br />
                    Manage cards
                </p>
            </div>
            <div class="card-footer">
                @Html.ActionLink("Funding Options", "Index", "Funding", null, new { @class = "btn btn-primary" })
            </div>
        </div>

        <div class="card text-center">
            <div class="card-block">
                <h4 class="card-title">Account History</h4>
                <p class="card-text">
                    View all financial transactions on my account
                </p>
            </div>
            <div class="card-footer">
                @Html.ActionLink("Account transactions", "Index", "Activity", null, new { @class = "btn btn-primary" })
            </div>
        </div>
        <div class="card text-center">
            <div class="card-block">
                <h4 class="card-title">User Settings</h4>
                <p class="card-text">
                    Edit personal details<br />
                    Change top-up settings<br />
                    Change password
                </p>
            </div>
            <div class="card-footer">
                @Html.ActionLink("Personal details", "Update", "Account", null, new { @class = "btn btn-primary" })
            </div>
        </div>
    </div>
</div>

2 个答案:

答案 0 :(得分:29)

Bootstrap 4中没有mt-20。引导程序4 margin classes是......

<强>米{两侧} - {大小}

尺寸 来自 0-5 ,且尺寸是1rem的默认间隔单位的一部分

  • 0 - 消除保证金
  • 1 - 设置 保证金为.25rem
  • 2 - 将保证金设置为.5rem
  • 3 - 将保证金设置为1rem
  • 4 - 将保证金设置为1.5rem
  • 5 - 将保证金设置为3rem

因此,您可以使用mt-3mt-4mt-5等。

http://www.codeply.com/go/29IGJHkqVd

答案 1 :(得分:1)

你可以在卡片下面换行:<br />。或者可以在card-deck类下添加底部边距:

.card-deck{
    bottom-margin: 10px;
}