【问题标题】:Avoiding overlap of elements inside a col?避免 col 内的元素重叠?
【发布时间】:2020-11-01 19:45:50
【问题描述】:

我目前对引导网格系统有点混乱,我有点理解它,但如果我更改 col 内元素的宽度,那么当我调整浏览器大小时它会重叠。

只是想在调整浏览器大小时让卡片响应,但我想同时更改卡片的大小而不使它们重叠。

This is how it looks like when I change the width

This is how it's supposed to look like

我现在就是这样做的:

<main>
    <div class="container-fluid">
        <div class="row">
            <div class="col-xl-4">
                <div class="card card-cascade dashboard-card bg-lightblue">
                    <div class="data mt-4 ml-3">
                        <div class="button px-2">
                            <a class="btn-floating btn-lg float-right"><i class="fas fa-thumbs-down"></i></a>
                        </div>
                        <h4 class="text-white mb-2">1</h4>
                        <p class="text-white">Test Card</p>
                    </div>
                </div>
            </div>
            <div class="col-xl-4">
                <div class="card card-cascade dashboard-card bg-lightblue">
                    <div class="data mt-4 ml-3">
                        <div class="button px-2">
                            <a class="btn-floating btn-lg float-right"><i class="fas fa-thumbs-up"></i></a>
                        </div>
                        <h4 class="text-white mb-2">0</h4>
                        <p class="text-white">Test Card 2</p>
                    </div>
                </div>
            </div>
            <div class="col-xl-4">
                <div class="card card-cascade dashboard-card bg-lightblue">
                    <div class="data mt-4 ml-3">
                        <div class="button px-2">
                            <a class="btn-floating btn-lg float-right"><i class="fas fa-ticket"></i></a>
                        </div>
                        <h4 class="text-white mb-2">0</h4>
                        <p class="text-white">Test Card 3</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>

有点坚持。 感谢您的帮助。

【问题讨论】:

  • 没有改变任何东西,也尝试将它应用到 colclass 但只是使它无法调整大小
  • 您使用的是 bootstrap 4 还是 bootstrap 5 (alpha)?应删除其中一个标签。
  • 我目前正在使用带有 mdbootstrap 的 bootstrap 5 (alpha)
  • 你还有其他 CSS 吗?

标签: html css mdbootstrap bootstrap-5


【解决方案1】:

给 col-xl-4 类:

  1. (94/3)% 的宽度
  2. 向左填充 1%
  3. 1% 的填充权

给容器流体类:

  1. 向左填充 20 像素
  2. 20px 的内边距

【讨论】:

    猜你喜欢
    • 2020-01-24
    • 2023-03-13
    • 1970-01-01
    • 2015-10-07
    • 2018-02-12
    • 1970-01-01
    • 1970-01-01
    • 2013-07-28
    • 1970-01-01
    相关资源
    最近更新 更多