html - 当标题变大或变小时对齐 woocommerce 价格

标签 html css woocommerce alignment

<分区>


关闭 6 年前

WooCommerce Divs

我需要调整产品的价格并使它们(如果可能)与按钮相关,而不是与它们上方的标题相关。如果可能的话,我也想避免使用最小高度。有什么建议吗?

最佳答案

.product-container {
  text-align: center;
  float: left;
  width: 250px;
  height: 470px;
  padding: 5px;
  border: thin solid #999;
  position: relative;
  margin-left: 10px;
}
.product-description {
  width: 100%;
  text-transform: uppercase;
  font-size: .8em;
  padding: 10px 0px;
}
.product-price {
  position: absolute;
  bottom: 50px;
  padding-top: 15px;
  text-align: center;
  width: 100%;
  font-size: 1.2em;
  font-weight: bold;
}
.add-to-cart {
  position: absolute;
  bottom: 5px;
  text-align: center;
  width: 100%;
  padding-top: 15px;
}
button {
  width: 100px;
  height: 30px;
  background-color: orange;
  color: white;
  border: none;
  border-radius: 5%;
}
<div class="product-container">
  <div class="product-image"><img src="http://placehold.it/250x350"></div>
  <div class="product-description">American crew powder cleanser style remover shampoo 250ml</div>
  <div class="product-price">€19.95</div>
  <div class="add-to-cart">
    <button>Add to cart</button>
  </div>
</div>
<div class="product-container">
  <div class="product-image"><img src="http://placehold.it/250x350"></div>
  <div class="product-description">American crew pomade 85ml</div>
  <div class="product-price">€12.15</div>
  <div class="add-to-cart">
    <button>Add to cart</button>
  </div>
</div>

我已经创建了一个示例。我看不到您的代码,所以我不得不做出一些假设。如果这对你有用,请告诉我。 fiddle :https://jsfiddle.net/beekvang/q30odku9/1/

关于html - 当标题变大或变小时对齐 woocommerce 价格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44002122/

上一篇:html - 样式 <hr> 元素以适应两个跨度

下一篇:jquery - 如何使用 Bootstrap 在一行中制作我的 Logo 、搜索栏和图标?

相关文章:

jquery - 自定义样式 jQuery UI 的 Datepicker?

Javascript 表单验证

php - 编辑产品帖子时 Hook

html - 使用浏览器问题保持文本移动

php - 从 WooCommerce 订单获取 protected 自定义订单项元数据数组

php - WooCommerce:如何删除运费计算器下“本地取件”选项中的邮政编码

html - 使两列高度相同

javascript - 继承另一个div的颜色?

php - 使用 Laravel 5 动态添加表单输入字段和存储值

javascript - 同一页面内的链接