Skip to content Skip to sidebar Skip to footer

Twitter Bootstrap Html Select Inside Pagination Component Is Offset And Not Aligned

When I try to use an html select inside of the pagination component the html select is offset and not properly aligned. I have only included the first half of the pagination with

Solution 1:

Try the following CSS:

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

Or, alternatively:

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

Solution 2:

If your able to do it without the label, here's the CSS I ended up using.

CSS

.pagination select {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    color: #337ab7;
    float: left;
    line-height: 1.42857;
    margin-left: -1px;
    padding: 6px12px;
    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: 10px16px;
}
.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: 5px10px;
}
.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

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

Example: http://www.bootply.com/KVb2hwLs57

Post a Comment for "Twitter Bootstrap Html Select Inside Pagination Component Is Offset And Not Aligned"