twitter-bootstrap - 具有相同宽度的响应式卡片组
问题描述
我正在设置一个网络应用程序,它调用渲染动态数量的卡片,它将显示一些信息。
我设法让它们使用相同的高度,但不知道如何让它们使用相同的宽度和高度,即使它们连续的卡片数量少于适合的数量,它们会拉伸而我没有不想要这种行为。
<div class="card-deck">
<div class="card mb-4">
<div class="card-body">
<h4 class="card-title">Titel</h4>
<h6 class="card-subtitle mb-2 text-muted">Subtitle</h6>
<p class="card-text">Text break </p>
<button class="btn btn-primary my-2 my-sm-0" type="submit"><fa-icon [icon]="['fas', 'sign-in-alt']"></fa-icon> Login</button>
</div>
</div>
</div>
</div>```
Expected result: Every card uses the same width
Actual result: Cards in the last row (if they are less than the amount that would fit) stretch to the whole container
解决方案
这可以通过使用
<div class="card mb-4 col-x">
其中 col-x 中的 x 范围可以从 1 到 12(来自引导网格),
它将生成指定宽度的甲板。
请参考代码链接:
https://codepen.io/diveshpanwar/pen/WqvPNW
推荐阅读
- java - JAVA TreeSet 使用的基本(非即时)支持数据结构是什么?
- angular - 如何使用 angular8 中的 window.open 将数据作为路径中的参数传递
- javascript - 使用 redux 时应该首选哪种生命周期方法?
- swagger - springdoc-openapi 规范生成与泛型继承
- android - 有没有办法为android中的软键盘外观提供动画?
- python - Kivy - 边框和字体粗细
- windows - 注册的 I/O 套接字和 Tcp 窗口大小
- authorization - 有没有办法通过使用 Keycloak 休息端点从 Keycloak 服务器获取一组资源详细信息
- pointers - 当我传递一个指针时,我失去了该接口上所有可用的方法
- python - 登录(请求,用户)功能在 django.contrib.auth 中不起作用