Remove scrollbars in Chrome when there is no overflow

0

In Google Chrome every time I have an overflow of whatever type, it shows me the scrollbars and I can not find the way they only appear when there is really overflow in the type overflow: scroll , because it also shows me the scrollbars when other types of overflow.

    
asked by JetLagFox 30.08.2017 в 11:17
source

1 answer

4

With the value auto you should only show the scroll when necessary:

div{
  overflow-y: auto;
  width: 400px;
  height: 100px;
  border: solid 1px black;
  margin: 10px;
}
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt</div>

<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
    
answered by 30.08.2017 / 11:34
source