面对这个问题,我的价格障碍到处都有不同的缩进。这是由于文本(产品名称)的长度。如何为所有相同的加价标出价格。我该怎么做?请帮帮我。至少是一个小例子。
<div class="product_grid">
<div class="product_section">
<div>
<a href="#">
<div>
<img class="product_image" src="#">
<div class="product_text">
<div class="product_name">Name</div>
<div class="product_price_block">
<div class="product_price empty">1200 ₽</div>
<div class="product_price">1800 ₽</div>
</div>
</div>
</div>
</a>
</div>
<div>
<button class="add_to_cart">Add to cart</button>
</div>
</div>
</div>
css
.product_grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
grid-row-gap: 20px;
grid-column-gap: 3%;
padding: 8px;
}
.product_grid > * {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 1rem;
border: 1px solid #ccc;
border-radius: 8px;
text-align: center;
}
.product_price_block {
display: flex;
justify-content: space-around;
border: 1px solid grey;
padding: 10px 12px;
margin-top: 3rem;
}
.add_to_cart {
border: 1px solid grey;
padding: 10px 12px;
margin-top: 3rem;
cursor: pointer;
background: none;
outline: none;
}
.product_image {
vertical-align: middle;
max-width: 100%;
}
谢谢!
答案 0 :(得分:0)
您可以固定产品名称div的高度。 试试这个:-
(^[A-Z]|[a-z])[0-9]*