CSS max-height and overflow auto always displays vertical scroll

As it turns out, another CSS style was causing the issue:

body{
    line-height: 1;
}

Anyone interested in learning about how and why this would cause an issue, can read about the line-height property here


I was having an issue with this, and I found that having position: relative on the child elements was causing the problem. Obviously this can't be the solution for everyone, especially if position: absolute is being used, but for me it worked.


Just to put in evidence the @Kuba Orlik's solution (he posted as comment on the accepted answer) that's the only one that worked for me.

Add this on inside elements:

line-height: normal;

Note: Explicitly normal not 1 because it's different


I have encounter this problem.But I solved this use the following css style:

div.yourcontainer{overflow-y:auto;}

If the container was higher than max-height,the vertical scrollbar will show.