[英]select has Extra top padding from div
我想要一个带有自定义箭头的下拉菜单。
我做了一个带有箭头图像背景的div包装器,围绕着我的选择。
问题是选择的div顶部填充了3-4个像素。 而且我找不到原因。
<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>
您可以尝试:在此示例中,我使用的导航栏高度为50px,但是对于50,则可以使用自己的导航栏或父对象的高度。
.styleSelect select{
line-height:50px;
height:50px;
/*and ofcourse your other code*/
}
这应该使对象垂直居中。 您也可以尝试vertical-align:middle;
嘿,我还发现,如果我向div添加font-size: 0 px
,那也可以
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.