将按钮与表单元素对齐

时间:2015-07-29 11:41:30

标签: twitter-bootstrap twitter-bootstrap-3

我有一个带下拉按钮和两个按钮的搜索栏。所有这些都有一个表单元素。这会扭曲它们的对齐,否则这是正确的。我错过了什么?错误的屏幕截图:http://imgur.com/4iYzFLF

代码:

<div class="row"> 
    <form method="POST" action="searchcategory.php" class = "col-sm-8">
    <div class="col-sm-6 col-sm-offset-6">
        <div class="input-group">
            <div class="input-group-btn search-panel">
                <button type="button" name="dropdown" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                    <span id="search_concept">Filter by</span> <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" role="menu">
                  <li><a href="#sup_cat" data-value="sup_cat">Super Category</a></li>
                  <li><a href="#cat" data-value="cat">Category</a></li>
                  <li><a href="#sub1" data-value="sub1">Sub Category 1</a></li>
                  <li><a href="#sub2" data-value="sub2">Sub Category 2</a></li>
                </ul>
            </div>
            <input type="hidden" name="search_param" value="all" id="search_param">         
            <input type="text" class="form-control" name="bar" placeholder="Search term...">
            <span class="input-group-btn">
                <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
           </span>
        </div>
    </div>
</form>
  <a href="addtree.php" class= "btn btn-info"><span class="glyphicon glyphicon-plus" aria-hidden="true"> ADD</span></a></form>
  <a href="uploadtree.php" class= "btn btn-info"><span class="glyphicon glyphicon-open" aria-hidden="true"> UPLOAD</span></a>  
  <a href="downloadtree.php" class= "btn btn-info"><span class="glyphicon glyphicon-save" aria-hidden="true"> DOWNLOAD</span></a>
   <form method ="POST" action = "category.php">
     <button class=" btn btn-danger" type="submit" name="submit"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> DELETE</button>
    </div>

1 个答案:

答案 0 :(得分:0)

根据页面其余部分的结构,这可能有所帮助。这很难说,所以如果可能的话,你应该发布与问题相关的所有代码。

&#13;
&#13;
.search-panel,
.content {
  padding: 10px 0;
}
@media (max-width: 480px) {
  .input-group .btn-group-justified button,
  form button.btn-danger {
    font-size: 10px;
  }
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <div class="col-md-8">
      <form method="POST" action="searchcategory.php">
        <div class="input-group search-panel">
          <div class="input-group-btn">
            <button type="button" name="dropdown" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <span id="search_concept">Filter by</span>  <span class="caret"></span>

            </button>
            <ul class="dropdown-menu" role="menu">
              <li><a href="#sup_cat" data-value="sup_cat">Super Category</a>

              </li>
              <li><a href="#cat" data-value="cat">Category</a>

              </li>
              <li><a href="#sub1" data-value="sub1">Sub Category 1</a>

              </li>
              <li><a href="#sub2" data-value="sub2">Sub Category 2</a>

              </li>
            </ul>
          </div>
          <input type="hidden" name="search_param" value="all" id="search_param" />
          <input type="text" class="form-control" name="bar" placeholder="Search term..." /> <span class="input-group-btn">
                <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span>

          </button>
          </span>
        </div>
        <div class="input-group">
          <div class="btn-group btn-group-justified" role="group">
            <div class="btn-group" role="group">
              <button type="button" class="btn btn-info"><span class="glyphicon glyphicon-plus" aria-hidden="true"> ADD</span>

              </button>
            </div>
            <div class="btn-group" role="group">
              <button type="button" class="btn btn-info"><span class="glyphicon glyphicon-open" aria-hidden="true"> UPLOAD</span>

              </button>
            </div>
            <div class="btn-group" role="group">
              <button type="button" class="btn btn-info"><span class="glyphicon glyphicon-save" aria-hidden="true"> DOWNLOAD</span>

              </button>
            </div>
          </div>
        </div>
      </form>
      <form method="POST" action="category.php">
        <button class=" btn btn-danger" type="submit" name="submit"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> DELETE</button>
      </form>
    </div>
    <div class="col-md-4">
      <p class="content">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked
        up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus
        Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a
        line in section 1.10.32. Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney
        College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32
        and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor
        sit amet..", comes from a line in section 1.10.32.</p>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;