我正在使用blogger.com的主题模板。我想有在主页上的博客文章就像一个砖石如所附图片显示。由于Blogger的限制,在服务器端计算并不容易,因此可以帮助决定要部署的col或col-4类。此外,使用blogger.com Package 一个div和两个div可能很困难。我想我可以使用JavaScript来移动这些HTML组件。然而,在我这样做之前,我想知道是否有任何自动的方法,Bootstrap可以将一个简单的div列表转换为如图所示的砖石堆栈。
f3temu5u1#
<!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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script> <style> .col-sm-6:nth-child(3n+1) { width: 100%; } .col-sm-6 { border: solid 10px #ffffff; } </style> </head> <body> <div class="container-fluid mt-3"> <div class="row"> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> <div class="col-12 col-sm-6 p-3 bg-primary text-white">.col</div> </div> </div> </body> </html>
1条答案
按热度按时间f3temu5u1#