Is it possible to implement a vertical scrollbar in a drop-down menu using only CSS?

I would like to implement vertical scrolling in the drop-down menu when the options in the menu exceed 8. Is it possible to achieve this using only the Css properties? Please let me know how I should do this.

+3
source share
3 answers

This is absolutely possible with CSS. All you have to do is set a fixed height in the menu (so set the height to 8 high positions) and give it overflow-y: auto. This tells the browser that if the fixed height is exceeded, a vertical scrollbar should appear.

+1
source

"overflow: auto" div. div, 8 , max-height:. IE6, IE6.

+1

do not ul li uladd the desired height, for example, height:80px;andoverflow-y:auto;

0
source

Source: https://habr.com/ru/post/1772521/


All Articles