切换布局
显示结果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap5 响应式图像 - 迹忆客(jiyik.com)</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script> <style> /* Custom CSS to beautify this example */ .box{ width: 400px; border: 5px solid #000; } </style> </head> <body> <div class="m-4"> <h2>无响应式图片</h2> <div class="box"> <img src="/demo_source/sky.jpg" alt="Cloudy Sky"> </div> <hr> <h2>响应式图片</h2> <div class="box"> <img src="/demo_source/sky.jpg" class="img-fluid" alt="Cloudy Sky"> </div> </div> </body> </html>