源代码 :
点击运行
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>图片卡片</h2> <p>图片在头部 (card-img-top):</p> <div class="card" style="width:400px"> <img class="card-img-top" src="https://www.ossoft.cn/images/mix/img_avatar.png" alt="Card image" style="width:100%"> <div class="card-body"> <h4 class="card-title">John Doe</h4> <p class="card-text">Some example text some example text. John Doe is an architect and engineer</p> <a href="#" class="btn btn-primary">See Profile</a> </div> </div> <br> <p>图片在底部(card-img-bottom):</p> <div class="card" style="width:400px"> <div class="card-body"> <h4 class="card-title">Jane Doe</h4> <p class="card-text">Some example text some example text. Jane Doe is an architect and engineer</p> <a href="#" class="btn btn-primary">See Profile</a> </div> <img class="card-img-bottom" src="https://www.ossoft.cn/images/mix/img_avatar.png" alt="Card image" style="width:100%"> </div> </div> </body> </html>
运行结果