html - 如何解决 bootstrap 4 网格系统的问题?
问题描述
我遇到了 Bootstrap-4 网格系统的问题。有 12 列,每当我使用少于 12 列时,行会自动居中。我想要左对齐,如何解决?
我的代码片段:
<div class="row justify-content-start con-flex">
<?php foreach($books as $book):?>
<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
<div id="single-book">
<div id="book-image">
<?php print '<img src = "'.strip_tags($book->book_image).'" alt = "">';?>
<div id="addto-cart"><a href=""><i class="fas fa-shopping-cart"></i> Add to cart</a></div>
</div>
<div class="book-text">
<div id="book-name"><?= substr(htmlentities($book->book_name),0,21) ?></div>
<div id="author">By <i><?= htmlentities($book->author) ?></i></div>
<div id="price"><?= htmlentities($book->price) ?>.TK</div>
<div id="book-details">
<?php print '<a href = "'.base_url().'users/book_view/'.$book->id.'">View details</a>'; ?>
</div>
</div>
</div>
</div>
<?php endforeach;?>
</div>
代码图像:
解决方案
根据Bootstrap 文档,应该可以解决您的问题
<div class="container">
<div class="row justify-content-start">
<div class="col-4">
content here...
</div>
<div class="col-4">
content here...
</div>
</div>
</div>
推荐阅读
- javascript - TypeError:channel.updateOverwrite 不是函数
- php - 如何在更新表单 Codeigniter 上显示复选框值?
- lua - lua z 维度中的 3d 光栅化器的问题不起作用
- python - 如何循环通过python json响应对象
- python - mosquitto mqtt 代理不会向订阅者发送超过 20 个发布数据包
- r - 在 R 中改变矩阵的形式
- coldfusion - lucee.transformer.library.tag.TagLibException 冷箱错误
- php - Detect common Password/PIN
- eclipse - 由于依赖项冲突而无法完成安装:eclipse 建模工具
- python - xmlrpc.client.ProtocolError: