簡體   English   中英

選擇具有div的額外頂部填充

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM