[英]Vertical Align Bootstrap Radio Button Image
我正在尝试将input-group-addon
与radio
元素结合起来。 示例代码如下。
http://www.bootply.com/1M34c3sy29
但radio
图像不在价格radio
部分的中心。
是否可以将价格部分的图像居中? 或者您是否为此类演示推荐另一种解决方案。
Bootstrap 正在添加一些样式,这些样式不允许您根据需要与 function 垂直对齐。 元素是绝对定位的。 我会尝试以另一种方式定位单选按钮,使用top
的 ZC7A628CBA22E28EB17B5F5C6AE2A266AZ 属性:
.input-group { display:inline-block;} #inlineradio2{ top: 13px; }
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <form class="form-horizontal"> <fieldset> <div class="form-group"> <div class="col-lg-12"> <div class="radio"> <label> <input id="inlineradio1" name="sampleinlineradio" value="option1" type="radio"> Automatic. Price will be set by the system </label> </div> <div class="radio"> <label> <input id="inlineradio2" name="sampleinlineradio" value="option2" type="radio"> <div class="input-group"> <span class="input-group-addon">Price</span> <input type="text" class="form-control" placeholder="" id="price-box" aria-describedby="Price"> </div>< -- /input-group --> </label> </div> </div> </div> </fieldset> </form>
我还更改了相关单选按钮上的 HTML id
属性的名称,因为id
应该是唯一的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.