【发布时间】:2019-09-08 12:36:23
【问题描述】:
我想改变这个特定 div 的垂直位置中的所有元素,使它们居中对齐,从上到下。
"vertical-align: top" 适用于我的按钮,但不适用于我的其他两个文本元素
"margin: 0px" 似乎不起作用
.FirstRetailer {
clear: both;
background-color: #07213F;
padding: 10px;
height: 62px;
line-height: 62px;
color: #FFFFFF;
vertical-align: top;
}
.RetailerRight1 {
float: right;
float: top;
height: 42px;
vertical-align: text-bottom;
}
.RetailerPrice1 {
padding: 0px 10px;
height: 22px;
}
.btnGoToProduct {
background-color: #A60000;
border: none;
color: white;
padding: 0px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
height: 42px;
line-height: 42px;
vertical-align: top;
}
<h3>
<div class="FirstRetailer">
<span class="RetailerLeft1">
Product name
</span>
<span class="RetailerRight1">
<span class="RetailerPrice1">
$100.00
</span>
<a href="link" class="btnGoToProduct">Go to product</a>
</span>
</div>
</h3>
我的问题示例(图片链接) https://cdn.shopify.com/s/files/1/0052/2246/5585/products/123_grande.PNG?v=1567946072
我希望“产品名称”和“$100.00”与按钮对齐。
在此先感谢
【问题讨论】: