gpt4 book ai didi

html - Bootstrap 4 中带有单选按钮的内衬标签

转载 作者:行者123 更新时间:2023-11-28 05:16:58 25 4
gpt4 key购买 nike

我正在试用 Bootstrap 4 表单,我想在其中内联带有标签的单选按钮。我让它与 bootstrap 3 一起工作,但我似乎无法与 bootstrap 4 及其自定义 radio 样式一起工作。

Desired Output:
Gender : ( ) Male ( )Female

谁能指出我正确的方向。以下是我的方法

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<form class="form-horizontal" method="post">
<div class="row">
<div class="form-group row col-lg-6">
<label for="firstName" class="col-3 col-form-label">First Name</label>
<div class="col-9">
<input type="text" class="form-control" />
</div>
<div class="form-check row col-lg-6">
<label class="col-3 col-form-label">Gender</label>
<div class="col-9">
<label class="custom-control custom-radio">
<input name="cat" type="radio" class="custom-control-input" value="1">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Male</span>
</label>
<label class="custom-control custom-radio">
<input id="mixed0" name="cat" type="radio" class="custom-control-input" value="0">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Female</span>
</label>
</div>
</div>
</div>
</div>
</form>
</div>

JS fiddle :https://jsfiddle.net/w7odmrtr/2/

最佳答案

我会这样做:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<form class="form-horizontal" method="post">
<div class="row">
<div class="form-group col-lg-12">
<label for="firstName" class="col-lg-3 col-form-label">First Name</label>
<div class="col-lg-9">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group col-lg-12">
<label class="custom-control custom-radio"><span class="custom-control-description">Some Label</span></label>
<label class="custom-control custom-radio">
<input name="cat" type="radio" class="custom-control-input" value="1">
<span class="custom-control-indicator"></span>
<span class="custom-control-description" th:text="#{bool.true}">Yes</span>
</label>
<label class="custom-control custom-radio">
<input id="mixed0" name="cat" type="radio" class="custom-control-input" value="0">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">No</span>
</label>
</div>
</div>
</form>
</div>

关于html - Bootstrap 4 中带有单选按钮的内衬标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44194051/

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