I have a div name bar whose CSS

.msg_panel { width:100px; height:45px; max-height:200px; padding: 3px; overflow-y:scroll; overflow-x:hidden; }
now, even if the height of the panel does not exceed the maximum height, I get the visibility of the scroll bar (you can see in the figure). I want the scroll bar to be visible only if the maximum height is reached.
I tried javascript, but this can only be done in css
source share