gpt4 book ai didi

html - 如何将按钮与文本(标签)放在同一行

转载 作者:太空宇宙 更新时间:2023-11-03 22:44:14 25 4
gpt4 key购买 nike

这是我的代码:

<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>

最佳答案

div 标签围绕标签并将其向左浮动,如下所示:

<div class="itembox addition">
<div style="float:left"><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>

Here is the JSFiddle demo

关于html - 如何将按钮与文本(标签)放在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42761178/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com