1

我正在使用bulma.css进行布局,但是当我给某些东西添加边框时,我发现它是重叠的。

这是重叠:

在此处输入图像描述

.shop div 似乎“如预期”

在此处输入图像描述

但是 .basket div 似乎有点爬升了。

在此处输入图像描述

这是一个演示的链接

和HTML:

<div id="app">
  <div class="container">
    <div class="shop">
      <div class="columns">
        <div class="column is-one-quarter product">
          <h3 class="title is-4">Cat</h3>
          <p>
            £<span>2.99</span></p>
          <div><button class="button">Add to basket</button></div>
        </div>
        <div class="column is-one-quarter product">
          <h3 class="title is-4">Dog</h3>
          <p>
            £<span>4.00</span></p>
          <div><button class="button">Add to basket</button></div>
        </div>
      </div>
    </div>
    <div class="basket">
      <h1>Basket</h1>
      <table class="table">
        <thead>
          <tr>
            <td>Item</td>
            <td>Quantity</td>
            <td>Price</td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td colspan="3">No items in the basket</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>

CSS:

// All of bulma.css
html,body{
  height:100%;
  padding:20px;
}

.product{
  box-sizing:border-box;
  border:2px solid #eaeaea;
  padding:20px;
}

我认为它与... flexbox有关?我不确定!

4

2 回答 2

2

在它的最新版本中,尝试 is-gapless 和 columns 类

于 2020-08-08T09:46:41.667 回答
1

由于 Bulma 代码中的这条规则,底部容器正在爬上顶部容器:

.columns:last-child {
    margin-bottom: -.75rem;
}

在此处输入图像描述

只需覆盖它。将此添加到您的代码中:

.columns:last-child {
    margin-bottom: 0 !important;
}

!important可能没有必要。我只是添加它以确保您的规则占上风。

于 2017-08-24T13:41:53.163 回答