0

I'm trying to positionate text input and button on the same row/line, but the button somehow goes up, see the screenshot.

Code:

<div class="row">
        <div class="col-md-8" ng-controller="OrdersController">
          <div class="well">
            <form role="form" class="form-horizontal">

              <div class="row">
                <div class="col-lg-8">
                  <label>Name</label>
                  <input type="text" class="form-control" placeholder="Enter patient">
                </div>
                <div class="col-lg-3">
                  <button type="button" class="btn btn-primary">Create new</button>
                </div>
              </div>

              <hr>
                <label>Private notes</label>
                <textarea  class="form-control" rows="3" placeholder="These notes are for your reference only."></textarea>

                <hr>
              <div class="col-md-4">
                <button type="submit" class="btn btn-primary">Save</button>
                <button type="submit" class="btn btn-primary">Open</button>
              </div>

            </form>
          </div>
        </div>
    </div>

Also you can check out demo on plunker
So, how place them on the same line ?

2 Answers 2

2

You can achieve this also by targeting that particular div and you set top margin to align it with the other elements.

html

<button type="button" class="btn btn-primary inline-button">Create new</button>

CSS

    @media(min-width 768px){
  .inline-button{
    margin-top:24px;
  }
}
Sign up to request clarification or add additional context in comments.

Comments

0

Add .form-inline to your <form> for left-aligned and inline-block controls.

<form class="form-inline" role="form">
  <div class="form-group">
    <label class="sr-only" for="">Email address</label>
    <input type="email" class="form-control" id="" placeholder="Enter email">
  </div>
  <button type="submit" class="btn btn-default">Sign in</button>
</form>

See -> http://getbootstrap.com/css/#forms-inline

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.