如何解决 css 中以下图像中的问题(我是 css/html 新手)
问题是如果产品标签太长,add button
会滑下来。如果标签很短,它会向上滑动。
这是css和html。
<div class="product-container">
<a href="#" class="thumbnail"><img src="img/sample_prod.jpeg" alt="Product name" class="ProductTopCell img-rounded"></a>
<div class="product-container-bottom">
<p class="product-label"><a href="#">Buxted Free Range Skinless Chicken Breast Fillets (430g)</a></p>
<p style="font-weight:600">Rs 43<small>/Kg</small></p>
<div class="product-add-button"><span class="quantity-cell">qty <input type="number" class="quantity-number-cell" value="1"> kg</span><button class="btn btn-primary" type="button">Add</button></div>
</div>
</div>
<div class="product-container">
<a href="#" class="thumbnail"><img src="img/sample_prod.jpeg" alt="Product name" class="ProductTopCell img-rounded"></a>
<div class="product-container-bottom">
<p class="product-label"><a href="#">Buxted Free Range Range Rang Skinless Chicken Breast Fillets (430g)</a></p>
<p style="font-weight:600">Rs 43<small>/Kg</small></p>
<div class="product-add-button"><span class="quantity-cell">qty <input type="number" class="quantity-number-cell" value="1"> kg</span><button class="btn btn-primary" type="button">Add</button></div>
</div>
</div>
<div class="product-container">
<a href="#" class="thumbnail"><img src="img/sample_prod.jpeg" alt="Product name" class="ProductTopCell img-rounded"></a>
<div class="product-container-bottom">
<p class="product-label"><a href="#"> Breast Fillets (430g)</a></p>
<p style="font-weight:600">Rs 43<small>/Kg</small></p>
<div class="product-add-button"><span class="quantity-cell">qty <input type="number" class="quantity-number-cell" value="1"> kg</span><button class="btn btn-primary" type="button">Add</button></div>
</div>
</div>
.product-container .thumbnail {
background: none;
border: none;
padding-bottom: 10px;
box-shadow: none;
}
.product-container {
border-bottom: 1px solid #C2BEB7;
width: 172px;
padding: 0 5px 15px 5px;
display: inline-block;
margin-bottom: 15px;
height: 280px;
vertical-align: top;
}
.product-container-bottom {
background-image: url(img/Dotted-line.gif);
background-position: top;
background-repeat: repeat-x;
padding-top: 10px;
vertical-align: bottom;
overflow: hidden;
}
.product-label {
line-height: 14px;
text-align: left;
font-size: 13px;
direction: ltr;
}
.product-label a {
color: #004B91;
}
.product-add-button {
margin-top:3px;
text-align:right;
vertical-align:baseline;
}
.quantity-cell {
font-size:12px;
vertical-align:bottom;
margin-bottom: 0px;
padding-right:7px;
}
.quantity-number-cell {
width:30px;
font-size:13px;
height:90%;
margin-bottom: 0px !important;
padding-bottom:1px;
}