1

当我尝试在分页组件内使用 html 选择时,html 选择会偏移并且未正确对齐。为简洁起见,我只包含了分页的前半部分,其中包含 html 选择。它应该说明问题,您可以在此处查看 JSFiddle

<div class="pagination pagination-large pagination-centered">
     <ul>
       <li><a class="first_record" rel="tooltip" data-original-title="First record" href="#">First</a></li>
       <li><a class="previous_record" rel="tooltip" data-original-title="Previous" href="#">Previous</a></li>
       <li><span>Display <select class="input-mini page_size">
      <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
       </li>
    </ul>
   </div>

任何帮助,将不胜感激。

4

2 回答 2

2

试试下面的 CSS:

.pagination select {
  height: 30px;
  margin-top: -7px;
  margin-bottom: -5px;
}

或者,或者:

.pagination select {
  height: 2em;
  margin-top: -0.5em;
  margin-bottom: -0.4em;
}
于 2012-11-29T22:04:10.003 回答
-1

如果您能够在没有标签的情况下做到这一点,那么这是我最终使用的 CSS。

CSS

.pagination select {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    color: #337ab7;
    float: left;
    line-height: 1.42857;
    margin-left: -1px;
    padding: 6px 12px;
    position: relative;
    text-align: center;
}
.pagination > li:first-child > select {
    border-bottom-left-radius: 4px;
    border-top-left-radius: 4px;
    margin-left: 0;
}
.pagination > li:last-child > select {
    border-bottom-right-radius: 4px;
    border-top-right-radius: 4px;
}
.pagination > li > select:hover, 
.pagination > li > select:focus {
    background-color: #eeeeee;
    border-color: #dddddd;
    color: #23527c;
}

.pagination-lg > li > select {
    font-size: 18px;
    padding: 10px 16px;
}
.pagination-lg > li:first-child > select {
    border-bottom-left-radius: 6px;
    border-top-left-radius: 6px;
}
.pagination-lg > li:last-child > select {
    border-bottom-right-radius: 6px;
    border-top-right-radius: 6px;
}

.pagination-sm > li > select {
    font-size: 12px;
    padding: 5px 10px;
}
.pagination-sm > li:first-child > select {
    border-bottom-left-radius: 3px;
    border-top-left-radius: 3px;
}
.pagination-sm > li:last-child > select {
    border-bottom-right-radius: 3px;
    border-top-right-radius: 3px;
}

HTML

<div class="container"><nav>
  <ul class="pagination">
    <li>
      <a href="#" aria-label="Previous">
        <span aria-hidden="true">«</span>
      </a>
    </li>
    <li><select onchange="if (this.value) window.location.href=this.value">
      <option value="?page=1">1</option>
      <option value="?page=2">2</option>
      <option value="?page=3">3</option>
      </select></li>
    <li>
      <a href="#" aria-label="Next">
        <span aria-hidden="true">»</span>
      </a>
    </li>
  </ul>
</nav>
</div>

示例: http: //www.bootply.com/KVb2hwLs57

于 2015-06-09T12:15:54.373 回答