gpt4 book ai didi

html - 如何让按钮与div对齐

转载 作者:太空宇宙 更新时间:2023-11-04 07:34:20 27 4
gpt4 key购买 nike

大家好,我现在正在努力实现这一点:(我希望按钮和数量框在同一行上)

enter image description here

但是由于某种原因,我的按钮在我的数量框下方,我不知道为什么,我现在正在使用 bootstrap 3,我尝试为每个按钮使用 col 6 并尝试 显示内联但不知道如何让它工作

html:

.plus-minus-input {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
margin-left: 136px;
}
.plus-minus-input .input-group-field {
text-align: center;
width: 50px;
height: 41px;
font-size: 16px;
line-height: 1.2;
border: 2px solid #e6e6e6;
}
.plus-minus-input .input-group-field::-webkit-inner-spin-button, .plus-minus-input .input-group-field ::-webkit-outer-spin-button {
-webkit-appearance: none;
appearance: none;
}
.plus-minus-input .input-group-button .circle1 {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.plus-minus-input .input-group-button .circle2 {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.btn-primary {
border-radius: 0px;
width: 42px;
height: 41px;
background-color: #e6e6e6;
border: 2px solid #e6e6e6;
color: #888888;
}
.btn-primary:hover, .btn-primary:active:focus, .btn:focus, .btn:active, .btn-primary:focus {
color: #888888;
background-color: #e6e6e6;
border-color: #e6e6e6;
outline: none !important;
box-shadow: none;
}
.btn-danger {
background-color: #222222;
border-radius: 23px;
font-family: Montserrat-Regular;
font-size: 15px;
color: white;
text-transform: uppercase;
border-color: #222222;
width: 57%;
height: 100%;
padding: 9px;
margin-bottom: 50px;
}
.btn-danger:hover {
background-color: #c39d6d;
border-color: #c39d6d;
}
<div class="input-group plus-minus-input">
<div class="input-group-button">
<button class="button hollow circle1 btn btn-primary" data-field="quantity" data-quantity="minus" type="button"><i aria-hidden="true" class="fa fa-minus"></i></button>
</div><input class="input-group-field" name="quantity" type="number" value="0">
<div class="input-group-button">
<button class="button hollow circle2 btn btn-primary" data-field="quantity" data-quantity="plus" type="button"><i aria-hidden="true" class="fa fa-plus"></i></button>
</div>
</div>
<button class="btn btn-danger" type="button">Add to cart</button>

任何帮助都会很棒,谢谢

最佳答案

.plus-minus-input 类中使用 display: inline-flex; 我还在按钮标签中添加了 addcart 类像这样的 CSS:

.addcart {
display: inline-block;
width: auto;
}

.plus-minus-input {
display: -webkit-box;
display: -ms-flexbox;
display: inline-flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
margin-left: 136px;
}
.plus-minus-input .input-group-field {
text-align: center;
width: 50px;
height: 41px;
font-size: 16px;
line-height: 1.2;
border: 2px solid #e6e6e6;
}
.plus-minus-input .input-group-field::-webkit-inner-spin-button, .plus-minus-input .input-group-field ::-webkit-outer-spin-button {
-webkit-appearance: none;
appearance: none;
}
.plus-minus-input .input-group-button .circle1 {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.plus-minus-input .input-group-button .circle2 {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.btn-primary {
border-radius: 0px;
width: 42px;
height: 41px;
background-color: #e6e6e6;
border: 2px solid #e6e6e6;
color: #888888;
}
.btn-primary:hover, .btn-primary:active:focus, .btn:focus, .btn:active, .btn-primary:focus {
color: #888888;
background-color: #e6e6e6;
border-color: #e6e6e6;
outline: none !important;
box-shadow: none;
}
.btn-danger {
background-color: #222222;
border-radius: 23px;
font-family: Montserrat-Regular;
font-size: 15px;
color: white;
text-transform: uppercase;
border-color: #222222;
width: 57%;
height: 100%;
padding: 9px;
margin-bottom: 50px;
}
.btn-danger:hover {
background-color: #c39d6d;
border-color: #c39d6d;
}
.addcart {
display: inline-block;
width: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="input-group plus-minus-input">
<div class="input-group-button">
<button class="button hollow circle1 btn btn-primary" data-field="quantity" data-quantity="minus" type="button"><i aria-hidden="true" class="fa fa-minus"></i></button>
</div>
<input class="input-group-field" name="quantity" type="number" value="0">
<div class="input-group-button">
<button class="button hollow circle2 btn btn-primary" data-field="quantity" data-quantity="plus" type="button"><i aria-hidden="true" class="fa fa-plus"></i></button>
</div>
</div>
<button class="addcart btn btn-danger" type="button">Add to cart</button>

关于html - 如何让按钮与div对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49092593/

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