Twitter Bootstrap form-inline Not Lining Controls Up

时间:2013-01-17 02:33:04

标签: css ruby-on-rails twitter-bootstrap

我在Rails应用程序中使用Twitter Bootstrap。我正在尝试使用“搜索”按钮和“帮助”按钮排列搜索字段,该按钮将使用Accordion Javascript控件通过帮助内容展开下面的区域。

我有一切正常,但是,“帮助”按钮与其他控件不在同一行。手风琴控制需要一个DIV,所以我不确定这是否会导致问题。

,而不是停留在同一行,“帮助”按钮显示在左对齐的搜索字段下方。

这是我的代码:

<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 -->

非常感谢所有帮助。

由于

1 个答案:

答案 0 :(得分:2)

您的手风琴按钮不需要驻留在容器中以便运行,因此只需删除.details.accordion容器,您的按钮应该与其余的控制按钮对齐就好了

<强> 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 -->

演示: http://jsbin.com/eyajig/1