我想定位我的单选按钮和checkboxes
内联位置我已经使用了这个css
代码但是它没有工作
CSS
.checkbox-inline, .radio-inline {
cursor: pointer;
display: inline-block;
font-weight: 400;
margin-bottom: 0;
padding-left: 20px;
position: relative;
vertical-align: middle;
}
input[type=radio] {
margin-left: -20px;
position: absolute;
}
html
<div>
<label> <b>carburant: </b><span>(*)</span></label>
<label class ='radio-inline'><input type='radio' name='carburant' value=1 checked> AA</label>
<label><input class ='radio-inline' type='radio' name='carburant' value=2> BB</label>
<label><input class ='radio-inline' type='radio' name='carburant' value=3> CC</label>
<label><input class ='radio-inline' type='radio' name='carburant' value=4> DD</label>
</div><br />
<div>
<label> <b>city: </b><span>(*)</span></label>
<label class ='checkbox-inline'><input type='checkbox' name='carburant' value=1 checked> AA</label>
<label><input class ='checkbox-inline' type='checkbox' name='carburant' value=2> BB</label>
<label><input class ='checkbox-inline' type='checkbox' name='carburant' value=3> CC</label>
<label><input class ='checkbox-inline' type='checkbox' name='carburant' value=4> DD</label>
</div><br />
我没有使用 twitter bootstrap,我正在使用 html5。 我想在同一行显示我的按钮。
谢谢。
最佳答案
你的问题不是很清楚,但我想你想内联你的单选按钮,我希望下面的解决方案对你有所帮助。
.checkbox-inline, .radio-inline {
cursor: pointer;
font-weight: 400;
margin-bottom: 0;
padding-left: 20px;
}
<div >
<label> <b>carburant: </b><span>(*)</span></label>
<label class ='radio-inline'><input type='radio' name='carburant' value=1 checked> AA</label>
<label><input class ='radio-inline' type='radio' name='carburant' value=2> BB</label>
<label><input class ='radio-inline' type='radio' name='carburant' value=3> CC</label>
<label><input class ='radio-inline' type='radio' name='carburant' value=4> DD</label>
</div><br />
关于css - 如何定位输入类型单选框和复选框内联位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32475551/