分页组件内部的Twitter引导HTML选择偏移和未对齐(Twitter bootstrap htm

2019-10-17 11:02发布

当我尝试使用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>

任何帮助,将不胜感激。

Answer 1:

试试下面的CSS:

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

或者,也可以使用:

.pagination select {
  height: 2em;
  margin-top: -0.5em;
  margin-bottom: -0.4em;
}


Answer 2:

如果你能做到这一点没有标签,这里是我最后使用的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



文章来源: Twitter bootstrap html select inside pagination component is offset and not aligned