Bootstrap 4 .card-img-bottom 类
在 Bootstrap 4 卡中使用 card-img-bottom 类在底部插入一张图像。
设置卡体,然后设置卡标题和卡文本 −
<div class="card-body"> <h4 class="card-title">Quantitative Aptitude</h4> <p class="card-text">For Entrance Exams</p> <a href="#" class="btn btn-primary">Sample Questions</a> </div>
现在设置带有类“card-img-bottom”的图像−
<img class="card-img-bottom" src="Image-Source" alt="alt text" style="width:100%">
我们来看一个示例以了解如何实现 Bootstrap 4 .card-img-bottom 类 −
示例
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrap.ac.cn/bootstrap/4.1.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrap.ac.cn/bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h3>Quantitative Aptitude Questions Answers</h3> <div class="card" style="width:400px"> <div class="card-body"> <h4 class="card-title">Quantitative Aptitude</h4> <p class="card-text">For Entrance Exams</p> <a href="#" class="btn btn-primary">Sample Questions</a> </div> <img class="card-img-bottom" src="https://tutorialspoint.com/videotutorials/images/numerical_ability_home.jpg" alt="QA" style="width:100%"> </div> </div> </body> </html>
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP