我在CSS中设置的选择框有问题。将鼠标悬停在Chrome中时会出现白框。在Safari中一切都很好。有线索吗? 我添加了我的CSS和HTML,以及问题的图片。第一个是Safari,第二个是Chrome
.dropdown {
position: relative;
margin: 0 auto;
top: 10;
left 50%;
width: 190px;
height: 2em;
line-height: 2;
background: #E9B6B0;
overflow:scroll ;
border-radius: .35em;
margin-bottom: 5px;
}
.dropdown select {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
background-image: none; /* remove the value that chrome dose not use */
background-color: #E9B6B0; /* set the value it does */
border-radius: 4px; /* make it look kinda like the background image */
border: 1px solid #888;
outline: 0;
box-shadow: none;
border: 0 !important;
background: #E9B6B0;
width: 100%;
height: 100%;
margin: 0;
padding: 0 0 0 .5em;
color: black;
cursor: pointer;
font-size: 15px;
}
.dropdown::after {
content: '\25BE';
position: absolute;
top: 0;
right: 0;
bottom: 0;
padding: 0 1em;
background: #E9B6B0;
pointer-events: none;
}
.dropdown:hover::after {
color: white;
}
.dropdown::after {
-webkit-transition: .25s all ease;
-o-transition: .25s all ease;
transition: .25s all ease;
}
<div class="dropdown">
<select id="genre" onchange="filterConcerts()" value="default">
<option value="default">Sjanger</option>
</div>
答案 0 :(得分:1)
更改溢出:滚动;溢出:auto;在.dropdown类中
.dropdown {
position: relative;
margin: 0 auto;
top: 10;
left 50%;
width: 190px;
height: 2em;
line-height: 2;
background: #E9B6B0;
overflow:auto ;
border-radius: .35em;
margin-bottom: 5px;
}
.dropdown select {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
background-image: none; /* remove the value that chrome dose not use */
background-color: #E9B6B0; /* set the value it does */
border-radius: 4px; /* make it look kinda like the background image */
border: 1px solid #888;
outline: 0;
box-shadow: none;
border: 0 !important;
background: #E9B6B0;
width: 100%;
height: 100%;
margin: 0;
padding: 0 0 0 .5em;
color: black;
cursor: pointer;
font-size: 15px;
}
.dropdown::after {
content: '\25BE';
position: absolute;
top: 0;
right: 0;
bottom: 0;
padding: 0 1em;
background: #E9B6B0;
pointer-events: none;
}
.dropdown:hover::after {
color: white;
}
.dropdown::after {
-webkit-transition: .25s all ease;
-o-transition: .25s all ease;
transition: .25s all ease;
}
<div class="dropdown">
<select id="genre" onchange="filterConcerts()" value="default">
<option value="default">Sjanger</option>
</div>