嗨,大家好我现在正试图实现这个目标:(我希望按钮和数量框在同一条线上)
但由于某些原因,我的按钮位于我的量化框下方,我不明白为什么,我现在正在使用bootstrap 3并且我已经尝试使用col 6
进行每次尝试{ {1}}但不知道如何让它发挥作用
HTML:
display inline

.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;
}

任何帮助都会很棒,谢谢
答案 0 :(得分:1)
在display: inline-flex;
课程中使用.plus-minus-input
,我还在css的按钮标记中添加了addcart
类,如:
.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>
&#13;