4

Sorry for my English.

Hi, faced with a problem in the Bootstrap 3, it is impossible to make the grouping of the two text fields and a button. Prompt solution.

enter image description here

4

2 回答 2

11

You can do it like this, with an input group and two input fields, and adding some css:

HTML:

<div class="input-group double-input">
    <input type="text" placeholder="First" class="form-control" />
    <input type="text" placeholder="Second" class="form-control" />
    <span class="input-group-btn">
        <button class="btn btn-default" type="button">Go!</button>
    </span>
</div><!-- /input-group -->

CSS:

.double-input .form-control {
    width: 50%;
    border-right-width: 0px;
}
.double-input .form-control:focus {
    border-right-width: 1px;
}

Check this fiddle: http://jsfiddle.net/aorcsik/TshQ7/

于 2013-11-01T09:07:23.533 回答
1

.input-group-addon{
  padding: 0;
  width: 0px;
  border:none;
  background-color: #ccc;
}
.input-group{
  width: 100%;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group">
  <div class="input-group">
     <input data-provide="datepicker" class="form-control">
     <div class="input-group-addon"></div>
     <input data-provide="datepicker" class="form-control">
     <span class="input-group-btn">
        <button class="btn btn-default" type="button">Go!</button>
    </span>
  </div>
</div>

于 2016-03-22T22:16:02.463 回答