3

I would like to implement a vertical scroll in a drop down menu when the options in the menu exceed 8.Is it possible to achieve this by using Css properties alone?Please let me know how I should go about this

3 Answers 3

1

Set an "overflow: auto" property on the containing div. To collapse the div if it is less than 8 items then you will need to use the max-height: property. It will not work for IE6 so use a hack to get around IE6.

Sign up to request clarification or add additional context in comments.

Comments

1

That is absolutely possible using CSS. All you need to do is set a fixed height on the menu (so set the height to however tall 8 items is) and give it overflow-y: auto. This tells the browser that if the fixed height is exceeded, a vertical scrollbar should appear.

1 Comment

overflow: scroll always shows a scroll bar. overflow-y: auto; will make it appear only when needed.
0

on your ul li ul add the height you want for example height:80px; and overflow-y:auto;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.