frosty
frosty

Reputation: 2669

Hide scroll bar before the overflow of the y-axis

I have a div that generates a scroll bar on overflow of y-axis, but the problem is that the thingy that contains the scroll bar appears before overflow of the y-axis. How do I hide the thingy that contains the scroll bar before y-axis is overflowed?

Result:

div {
border: 1px solid black;
width: 300px;
height: 300px;
overflow-y: scroll;
}
<div> Hello </div>

Need Result:

div {
border: 1px solid black;
width: 300px;
height: 300px;
}
<div> Hello </div>

Upvotes: 0

Views: 285

Answers (1)

Siddartha Adusumalli
Siddartha Adusumalli

Reputation: 61

You can use overflow-y: auto. Then the thingy(scrollbar) appears only when there is an overflow

Upvotes: 1

Related Questions