Scott S.
Scott S.

Reputation: 759

Twitter Bootstrap form-inline Not Lining Controls Up

I'm using Twitter Bootstrap in a Rails application. I'm trying to line up a search field with the Search button and a Help button which will use the Accordion Javascript control to expand the area below with Help content.

I have everything working, but, the Help button isn't staying on the same line as the other controls. The accordion control requires a DIV so I'm not sure if that's causing a problem. Instead of staying on the same line the Help button appears just below the search field left aligned.

Here is my code:

<p><strong>Enter Search Criteria</strong></p>
        <form class="form-inline">

          <input type="text" class="input-large" placeholder="Name, Phone, Conf Rm" autofocus >
          <button type="submit" class="btn">Search</button> 
            <div class="details">

                        <!-- accordian button -->

                <div class="accordion">
                  <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseHelp"> <button type="link" class="btn btn-info btn-small">
                      <i class="icon-question-sign"></i>
                    </button></a>
                </div>
        </form>
    </div>

    <!-- Accordian area -->

        <div id="collapseHelp" class="accordion-body collapse style="height: 0px; ">
          <div class="accordion-inner">
            <p><strong>Person Search:</strong> Last Name, First Name (e.g. Smith, John)</p>
                <p><strong>Conference Room Search:</strong> Plaza-Building, Suite-Name (e.g South-I2W-20E-1)</p>
                <p><strong>Phone Number Search:</strong> Please provide at least the last 4 digits of the phone number (e.g. 8686)</p>
          </div>
        </div>

    <!-- End accordian area -->

All help is greatly appreciated.

Thanks

Upvotes: 1

Views: 743

Answers (1)

Andres I Perez
Andres I Perez

Reputation: 75409

Your accordion button does not need to reside within a container in order to function, so just remove the .details and .accordion containers and your button should line up with the rest of the control buttons just fine.

HTML

<p><strong>Enter Search Criteria</strong></p>
        <form class="form-inline">

          <input type="text" class="input-large" placeholder="Name, Phone, Conf Rm" autofocus >
          <button type="submit" class="btn">Search</button> 
                        <!-- accordian button -->

          <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseHelp"> <button type="link" class="btn btn-info btn-small">
              <i class="icon-question-sign"></i>
            </button></a>

        </form>


    <!-- Accordian area -->

        <div id="collapseHelp" class="accordion-body collapse" style="height: 0px; ">
          <div class="accordion-inner">
            <p><strong>Person Search:</strong> Last Name, First Name (e.g. Smith, John)</p>
                <p><strong>Conference Room Search:</strong> Plaza-Building, Suite-Name (e.g South-I2W-20E-1)</p>
                <p><strong>Phone Number Search:</strong> Please provide at least the last 4 digits of the phone number (e.g. 8686)</p>
          </div>
        </div>

    <!-- End accordian area -->

Demo: http://jsbin.com/eyajig/1

Upvotes: 2

Related Questions