我遇到HTML下拉列表(select
标签)的问题,当我尝试在Firefox中打开网站时,其选项显示在浏览器窗口之外,但在其他浏览器中工作正常。
我希望如果内容长度太大,那么下拉列表应该向左侧弹出,否则它应该是(默认)右侧。
:root .css3-metro-dropdown option,
:root .css3-metro-dropdown:after,
:root .css3-metro-dropdown::after,
:root .css3-metro-dropdown select {
color: #fff;
}
:root .css3-metro-dropdown select,
:root .css3-metro-dropdown:after,
:root .css3-metro-dropdown::after {
display: block;
background: #78ba00;
}
:root .css3-metro-dropdown select,
:root .css3-metro-dropdown option {
padding: 8px;
}
:root .css3-metro-dropdown {
position: relative;
display: inline-block;
border: 0;
}
:root .css3-metro-dropdown::after {
content: "\25bc";
position: absolute;
top: 0;
right: 0;
display: block;
width: 32px;
font-size: 12px;
line-height: 34px;
text-align: center;
-webkit-pointer-events: none;
-moz-pointer-events: none;
pointer-events: none;
}
:root .css3-metro-dropdown select {
height: 34px;
border: 0;
vertical-align: middle;
font: normal 12px/14px"Segoe UI", Arial, Helvetica, Sans-serif;
outline: 0 none;
}
:root .css3-metro-dropdown option {
background: #fff;
color: #333;
}
<span class="css3-metro-dropdown">
<select name="dropdown-1">
<option value="0">Client-side Languages</option>
<option value="1">JavaScript</option>
<option value="2">CSS3</option>
<option value="3">HTML5</option>
</select>
</span>