我想要一个带有定制箭头的下拉菜单。
我已经做了一个div包装与箭头图像背景围绕我的选择。
问题是,select有3-4像素来自div的顶部填充。我也找不到原因。
<style>
.styleSelect select {
font-weight:bold;
-moz-appearance:none;
-webkit-appearance: none;
border:none;
width: 140px;
}
.styleSelect select::-ms-expand {
display: none;
}
.styleSelect {
width: 120px;
overflow: hidden;
background: url("/Images/dropdown_arrow.gif") no-repeat right #fff;
border: 1px solid #000;
float: right;
margin-left: 3px;
border-radius: 8px;
}
</style>这是我的html:
<form>
<div class="styleSelect">
<select></select>
</div>
</form>发布于 2015-04-27 08:52:56
您可以尝试这样做:在本例中,我使用的导航栏高度为50 of,但对于50,您可以使用您自己的导航条或父对象高度。
.styleSelect select{
line-height:50px;
height:50px;
/*and ofcourse your other code*/
}这应该是物体垂直的中心。您也可以尝试vertical-align:middle;
发布于 2015-04-27 10:11:29
嘿,我还发现,如果我把font-size: 0 px添加到div中--这也有效。
https://stackoverflow.com/questions/29889691
复制相似问题