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.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/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.tw/videotutorials/images/numerical_ability_home.jpg" alt="QA" style="width:100%">
    </div>
  </div>
 </body>
</html>

更新時間:2020 年 6 月 17 日

瀏覽量:403

啟動你的事業

完成課程獲得認證

立即開始
廣告
© . All rights reserved.