0

I have very simple example with bootstrap here:

<div class="col-sm-12">
    <div class="col-sm-12">
      <div class="col-sm-2">
        <input class="form-control" placeholder="Last name, first name" />
      </div>
      <div class="col-sm-1">
        <button class="btn btn-success btn-block">Search</button>
      </div>
    </div>
  </div>

Input and button should be side by side (like it's always used to be) - but it's not. Input is at the top of button (see photo below). What has happened with bootstrap col classes?

enter image description here

FrenkyB
  • 6,625
  • 14
  • 67
  • 114

1 Answers1

1

You need to use .row class for columns.

And those columns are too narrow to show contents.

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">


<div class="row">
  <div class="col-sm-3">
    <input class="form-control" placeholder="Last name, first name" />
  </div>
  <div class="col-sm-3">
    <button class="btn btn-success btn-block">Search</button>
  </div>
</div>
zmag
  • 7,825
  • 12
  • 32
  • 42
  • But this is new. OK, my previous bootstrap version was 3.3 - and my case was working. They've changed this. This is not backward compatible. – FrenkyB Nov 25 '19 at 01:00