正常的JavaScript下拉菜单样式为什么会控制不了滚动条

css就加入了一句display等于none,就操作不了滚动条了删除掉就可以滑动

display:none是元素被隐藏了。你滚动也没用

你是要这种效果吗


```html
<!DOCTYPE html>
<html>
<head>
    <title>Combobox</title>
    <meta charset="utf-8">
    <style type="text/css">
        *{
            box-sizing:border-box;
        }
        input,select{
            width: 200px;
        }
        #words{
            display: none;
        }
    </style>
</head>
<body>
    <input id="show" type="text" name=""> <br />
    <select id="words">
        <option>A</option>
        <option>B</option>
        <option>C</option>
        <option>D</option>
        <option>E</option>
        <option>F</option>
        <option>G</option>
    </select>
 
    <script type="text/javascript">
        let show = document.getElementById('show');
        let words = document.getElementById('words');
        show.onclick = function(e){
            words.style.display = 'block';
        }
        words.size = 3;
        words.onchange = function(e){
            var option = this.options[this.selectedIndex];
            show.value = option.innerHTML;
            words.style.display = 'none';
        }
    </script>
</body>
</html>

```
搬运自

https://blog.csdn.net/swl979623074/article/details/71438656/