Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7943845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:23:26+00:00 2026-06-04T00:23:26+00:00

Why don’t buttons and inputs align well in Bootstrap? I tried something simple like:

  • 0

Why don’t buttons and inputs align well in Bootstrap?

I tried something simple like:

<input type="text"/><button class="btn">button</button>

The button is about 5px lower than the input in chrome/firefox.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:23:27+00:00Added an answer on June 4, 2026 at 12:23 am

    Twitter Bootstrap 4

    In Twitter Bootstrap 4, inputs and buttons can be aligned using the input-group-prepend and input-group-append classes (see https://getbootstrap.com/docs/4.0/components/input-group/#button-addons)

    Group button on the left side (prepend)

    <div class="input-group mb-3">
      <div class="input-group-prepend">
        <button class="btn btn-outline-secondary" type="button">Button</button>
      </div>
      <input type="text" class="form-control">
    </div>
    

    Group button on the right side (append)

    <div class="input-group mb-3">
      <input type="text" class="form-control">
      <div class="input-group-append">
        <button class="btn btn-outline-secondary" type="button">Button</button>
      </div>
    </div>
    

    Twitter Bootstrap 3

    As shown in the answer by @abimelex, inputs and buttons can be aligned by using the .input-group classes (see http://getbootstrap.com/components/#input-groups-buttons)

    Group button on the left side

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

    Group button on the right side

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

    This solution has been added to keep my answer up to date, but please stick your up-vote on the answer provided by @abimelex.


    Twitter Bootstrap 2

    Bootstrap offers an .input-append class, which works as a wrapper element and corrects this for you:

    <div class="input-append">
        <input name="search" id="search"/>
        <button class="btn">button</button>
    </div>
    

    As pointed out by @OleksiyKhilkevich in his answer, there is a second way to align input and button by using the .form-horizontal class:

    <div class="form-horizontal">
        <input name="search" id="search"/>
        <button class="btn">button</button>
    </div>
    

    The Differences

    The difference between these two classes is that .input-append will place the button up against the input element (so they look like they are attached), where .form-horizontal will place a space between them.

    — Note —

    To allow the input and button elements to be next to each other without spacing, the font-size has been set to 0 in the .input-append class (this removes the white spacing between the inline-block elements). This may have an adverse effect on font-sizes in the input element if you want to override the defaults using em or % measurements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know if this is a well known 'thing' or something new in
Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything,
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
Don't exactly know what to search for: If i edit text in vim it
I don't know if this has been asked before, but what i'd like to
I don't like Jackson. I want to use ajax but with Google Gson. So
Don't freak out about the length of my post, it's pretty simple, I just
Don't you hate it when you have class Foobar { public: Something& getSomething(int index)
Don't let below code scare you away . The question is really simple, only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.