这是我的代码怎么办:我把按钮在同一行文本(标签)
<div class="itembox addition">
<label id="lblItemPrice">Price: 10.90$</label>
<br />
<label id="lblShipping">Shipping: 0.99$</label>
<button id="btnBuy" class="btn" style="float: right;">Buy</button>
</div>
我希望按钮将链接到div的顶部。
.addition {
width: 500px;
padding: 20px 20px;
cursor: default !important;
}
.itembox {
cursor: pointer;
background: #fff;
line-height: 20px;
box-shadow: 0 -1px 0 #e0e0e0, 0 0 2px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .24);
display: block;
padding: 10px 10px;
text-align: left;
display: table-cell;
}
.btn {
background-color: transparent;
border: 5px solid #616161;
color: #616161;
text-align: center;
/*height: 50px;*/
line-height: 50px;
width: 100px;
box-sizing: border-box;
font-size: 22px;
font-weight: bold;
cursor: pointer;
}
<div class="itembox addition">
<label id="lblItemPrice">Price: 10.90$</label>
<br />
<label id="lblShipping">Shipping: 0.99$</label>
<button id="btnBuy" class="btn" style="float: right;">Buy</button>
</div>
你可以通过CSS'margin-top'属性来完成。但我觉得你必须升级你的代码结构。 –
首先,我试着用'margin'来做,但它不起作用,其次我是一名学生 –
在你的'btn' class css上添加'margin-top:-25px'。它会做的。 –