[英]Space between two buttons on a Bootstrap form
I want to add some space between 2 buttons. 我想在2个按钮之间添加一些空间。 This form is created using bootstrap.
此表单是使用引导程序创建的。 Tried a number of tricks but couldn't get what I want.
尝试了许多技巧,但无法获得我想要的东西。 The same page is accessed via mobile too.
也可以通过移动设备访问同一页面。
Here is my code along with screenshot: 这是我的代码以及屏幕截图:
<div class="input-group">
<span class="input-group-btn">
<input type="button" style="border-radius: 10px;" id="button1" class="btn btn-primary btn-lg btn-block" value="My Provider"/>
</span>
<span class="input-group-btn" >
<input type="button" style="border-radius: 10px;" id="button2" class="btn btn-primary btn-lg btn-block" value="Any Provider"/>
</span>
</div>
The problem is Bootstrap's btn-block
class. 问题是Bootstrap的
btn-block
类。
A block level button spans the entire width of the parent element.
块级按钮跨越父元素的整个宽度。
http://www.w3schools.com/bootstrap/bootstrap_buttons.asp http://www.w3schools.com/bootstrap/bootstrap_buttons.asp
Try removing that class from each of your buttons, setting the width of the input-group
class to 100% and adding margin after the first button. 尝试从每个按钮中删除该类,将
input-group
类的宽度设置为100%,并在第一个按钮之后添加边距。
input[type=button] { border-radius: 10px; width: 47%; } .input-group { display: inline-block; width: 100%; } input[type=button]:first-child { margin-right: 20px; }
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <div class="input-group"> <input type="button" id="button1" class="btn btn-primary btn-lg" value="My Provider"/> <input type="button" id="button2" class="btn btn-primary btn-lg" value="Any Provider"/> </div>
You can add paddings to input-group-btn
blocks. 您可以将填充添加到
input-group-btn
块。
.container { margin-top: 50px; } .input-group-btn-left { padding-right: 30px; } .input-group-btn-right { padding-left: 30px; }
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <div class="container"> <div class="input-group"> <span class="input-group-btn input-group-btn-left"> <input type="button" id="button1" class="btn btn-primary btn-lg btn-block" value="My Provider" style="border-radius: 10px;"> </span> <span class="input-group-btn input-group-btn-right"> <input type="button" id="button2" class="btn btn-primary btn-lg btn-block" value="Any Provider" style="border-radius: 10px;"> </span> </div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.