suchen

Heim  >  Fragen und Antworten  >  Hauptteil

Chrome wendet bei der Auswahl von Optionen keinen Abstand an

Ausfüllen der Option „Auswahl“ funktioniert in Chrome nicht

<style>
select option { padding:5px 0px; }
</style>    
<select>
<option>1</option>
<option>2</option>
<option>3</option> 
</select>


P粉683665106P粉683665106505 Tage vor659

Antworte allen(1)Ich werde antworten

  • P粉420868294

    P粉4208682942023-10-15 00:25:08

    我刚刚找到了一种将填充应用于 chrome 中的选择输入的方法

    select{
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        padding: 5px;
    }

    似乎可以在当前的 chrome 39.0.2171.71(64 位)和 safari 中工作(我只在 Mac 上测试过)。

    这似乎删除了添加到选择输入的默认样式(它还删除了下拉箭头),但允许您使用自己的样式,而无需 Chrome 覆盖它。

    我在使用此处的代码时偶然发现了此修复:http://fettblog.eu/style-select-elements/< /a>

    Antwort
    0
  • StornierenAntwort