Asaf Nevo Asaf Nevo - 6 months ago 17
CSS Question

Css overflow-y: how to show only when needed

I'm adding the overflow-y parameter to "scroll" in my css in order to have scrolling bar in case of overflow..

My problem is that if the content is not overflowing - i'm still having the blank scroll bar.

How can i set the overflow to show the scrolling bar only when needed ?


You can set it to auto

overflow-y : auto;

It will only show scroll bar in case of overflow.

Refer : What browsers support `overflow-y`?