【问题标题】:css styling with bulma cards布尔玛卡片的 CSS 样式
【发布时间】:2020-12-01 21:55:06
【问题描述】:

我确实有以下 HTML 输出:

所以,您可以看到页脚不匹配...

我的 css 组件如下所示:

.card-equal-height {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-equal-height
.card-footer {
  margin-top: auto;
  height: 100%;
}

.card-equal-height.card-footer 这部分无法正常工作。我希望页脚与订单卡匹配,无论描述有多长。

html:

<div [ngClass]="{'card-highlight': product.listItemHovered}" class="card card-equal-height"
                 (mouseenter)="hoverListItem(product)"
                 (mouseleave)="hoverListItem(product)"
                 (click)="test(product)">
      <div class="card-image">
        <figure class="image is-square">
          <img [src]="product.imageURL" alt="{{product.title}}">
        </figure>
      </div>
      <div class="card-content">
        <p class="title has-text-centered"> {{product.title}}</p>
        <p class="subtitle">{{product.price | currency: "USD"}}</p>
      </div>
      <div class="card-footer">
        <p class="card-footer-item">
          <button (click)="removeFromCart(product); showRemoved()"
                  class="button is-danger is-outlined is-pulled-left is-small"> Remove
          </button>
        </p>
        <p class="card-footer-item">
          <button (click)="addToCart(product);showAdded()"
                  class="button is-outlined is-primary is-pulled-right is-small"> Add to Cart
          </button>
        </p>
      </div>
</div>

【问题讨论】:

    标签: html css angular bulma card


    【解决方案1】:

    我认为您可以使用 flex-grow 来实现更改“卡片内容”的高度(忘记更改 .card-footer)

    .card-equal-height
    .card-content {
      flex-grow:1;
    }
    

    有关 flex 的更多信息,请查看link in css-tricks

    【讨论】:

      猜你喜欢
      • 2020-09-11
      • 1970-01-01
      • 1970-01-01
      • 2020-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多