css - Bootstrap 4 增加卡片列数

标签 css sass bootstrap-4

是否可以增加 bootstrap-4 卡列数? https://plnkr.co/edit/oIapj1imlMQ1M4vo1O5R?p=preview

这仅显示推到左侧的 3 列,右侧剩余 3 列为空。我将此 sass 放在 bootstrap-4 默认样式之后:

.card-columns {
  // sm
  @media (min-width: 576px) {
    column-count: 3;
  }
  // md
  @media (min-width: 768px) {
    column-count: 4;
  }
  // lg
  @media (min-width: 992px) {
    column-count: 5;
  }
  // xl
  @media (min-width: 1200px) {
    column-count: 6;
  }
}

我看到的所有示例都没有成功增加列数,即使使用 sass 也是如此。如果你知道怎么做,你会发布一个简单的例子来证明它是可能的吗?

最佳答案

这个引导解决方案有缺陷。这还不是万无一失的解决方案。您可以阅读here .

Why not work if increase the default column-count: value;?

因为.card class包含display: ***;width: ***;属性(property)。您应该针对此 column-count: 问题编写自定义 CSS。您需要阅读此article 。例子是here .

My personal suggestion is avoid this css solution from production site. Hope this help.

关于css - Bootstrap 4 增加卡片列数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47600465/

相关文章:

css - HomeScreen Web 应用程序中的 iOS 8 状态栏覆盖 + 页脚 'bar'

javascript - Div 位置不适用于任何值设置

javascript - 为什么在可拖动事件期间显示和隐藏捕捉对象时可拖动元素不响应捕捉选项?

html - 如何制作100%高度和固定位置的侧边栏

css - Node-Sass 不会编译/转换 @use "module"

css - SASS:覆盖 Bootstrap 的默认主色、成功、信息等颜色

javascript - 构建元素时重写sass url

html - Jumbotron 和 Footer 没有拉伸(stretch)到手机屏幕设备的宽度

html - Github Pages 显示不同于 VS Code 实时服务器

javascript - 您能否在引导模式上使用 'x'(关闭)按钮来调用 JavaScript 函数而不是关闭模式?