Reputation: 2669
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
Reputation: 61
You can use overflow-y: auto
. Then the thingy(scrollbar) appears only when there is an overflow
Upvotes: 1