【发布时间】:2020-07-04 22:24:58
【问题描述】:
所以基本上在使用 Django 和 bootstrap 4.4 制作一个简单的网站时,我遇到了这个问题。我正在使用“卡片”以网格格式添加书籍图像,就像在书店 Web 应用程序中一样。但卡片的尺寸不相等。 如何在 bootstrap 4.4 中对齐卡片图像,使所有卡片具有相同的宽度和高度,同时保持对窗口大小变化的响应。??
我在下图中的问题。正如你所看到的,当我添加不同的图像时,卡片的大小也不同,它的大小也会改变。 enter image description here
html
<div class="container">
<div class="row">
{% for book in object_list %}
<div class="col s3">
<div class="card">
<img class="img-fluid" src="{{book.book_image}}" alt="">
<div class="card-body">
</div>
</div>
<p class="text-white">{{book.name}}</p>
</div>
{% endfor %}
</div>
</div>
和.css
body{
background: white url('images/webbg.jpg') no-repeat center center;
background-size: cover;
}
我真正想要的图片示例enter image description here 我想要与上图中的完全一样,循环从我的数据库中加载图像。(所以不是嵌入在 html 代码中的硬编码图像链接)
【问题讨论】:
-
它是什么样子的
标签: css django python-3.x bootstrap-4