如何使用 bootstrap 行 class 为卡片创建 3 列
How to create 3 columns for cards using bootstrap row class
我正在尝试使用 bootstrap 4 行 class 在三个不同的列中显示我页面的内容(显示在卡片中)。我该怎么做?
我正在使用 Laravel 5.8 和 bootstrap 4. 轮播和导航栏等其他 bootstrap 功能正常工作。
主要内容的代码 blade file-views/layout/app.blade.php 如下所示;
<div class="container-fluid">
@yield('content')
</div>
那么我想要的页面 layout-views/pages/secondpage.blade.php 是;
@extends('layout.app')
@section('content')
<div class="col-12 text-center">
<h2> Page caption</h2>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
</div>
@endsection
我希望看到卡片排列在三个不同的列中,但它们都在一个列中。
你有一个额外的 div 关闭标签,用于所有三个
这就是为什么你把所有的都放在一栏中
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
<!--</div>-->
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<!--</div>-->
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<!--</div>-->
</div>
这是由于每个 col-md-4 div 之后的额外 div 造成的。我在 HTML.
中做了一些更正
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
我正在尝试使用 bootstrap 4 行 class 在三个不同的列中显示我页面的内容(显示在卡片中)。我该怎么做?
我正在使用 Laravel 5.8 和 bootstrap 4. 轮播和导航栏等其他 bootstrap 功能正常工作。
主要内容的代码 blade file-views/layout/app.blade.php 如下所示;
<div class="container-fluid">
@yield('content')
</div>
那么我想要的页面 layout-views/pages/secondpage.blade.php 是;
@extends('layout.app')
@section('content')
<div class="col-12 text-center">
<h2> Page caption</h2>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
</div>
@endsection
我希望看到卡片排列在三个不同的列中,但它们都在一个列中。
你有一个额外的 div 关闭标签,用于所有三个 这就是为什么你把所有的都放在一栏中
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
<!--</div>-->
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<!--</div>-->
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<!--</div>-->
</div>
这是由于每个 col-md-4 div 之后的额外 div 造成的。我在 HTML.
中做了一些更正<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>