【问题标题】:Responsive Gallery not working. How can I make the cards responsive?响应式画廊不工作。如何使卡片响应?
【发布时间】:2021-01-15 10:17:47
【问题描述】:

我一直在关注此W3 tutorial 以创建画廊视图。问题是它在移动设备上看起来很糟糕。它每行保留三张卡片,并使它们超级小......

我查看了bootstrap documentation on containers,看到了我尝试过的这个类名:

class="container-md" 

但这并没有让他们按照我想要的方式做出响应。它仍然保持他们三个连续。

然后我尝试删除这个 CSS:

/* Create three equal columns that floats next to each other */
.column {
  float: left;
  width: 33.33%;
  display: none; /* Hide all elements by default */
}

但是每行只有一个大...并且看起来也破坏了排序按钮...

如果您想查看我的完整代码和 CSS,可以在这里查看:https://www.seekadventure.net/GearLocker.html

【问题讨论】:

    标签: html css twitter-bootstrap bootstrap-4


    【解决方案1】:

    尝试将类 row row-cols-1 row-cols-sm-2 row-cols-md-3 添加到具有类 row 的行元素中,以使行响应。详情请查看document

    【讨论】:

    • 然后我还需要将 col 添加到每张卡的类中,对吗?
    猜你喜欢
    • 2021-08-12
    • 1970-01-01
    • 2018-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多