我正在尝试使这些列在桌面屏幕上显示为3列宽,在移动屏幕上显示为1列宽。我不知道为什么,但是他们的表现不符合我的预期。我该怎么做?
<section class="pricing-section py-5" data-aos="fade-in" data-aos-duration="2000">
<div class="container single-col-max-width">
<div class="card-deck mb-3 text-center">
<div class="card col-md-4 col-sm-12 box-shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Basic</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$500 <small class="text-muted">+</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
<div class="card col-md-4 col-sm-12 box-shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Standard</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$500 <small class="text-muted">+</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
<div class="card col-md-4 col-sm-12 box-shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Premium</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$500 <small class="text-muted">+</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
</div>
</div>
<!--//container-->
</section>
答案 0 :(得分:4)
在移动视图中签出以下代码:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<section class="pricing-section py-5" data-aos="fade-in" data-aos-duration="2000">
<div class="container">
<div class="row">
<div class="col-sm-4">
<div class="card shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Basic</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$500 <small class="text-muted">+</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Standard</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$500 <small class="text-muted">+</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Premium</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$500 <small class="text-muted">+</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
</div>
</div>
</div>
</section>