Setting overflow-x: hidden adds a vertical scrollbar [duplicate]

Check out this answer to a related question: https://stackoverflow.com/a/6433475/3583023

It explains why

el {
  overflow-x: hidden;
  overflow-y: visible;
}

renders as

el {
  overflow-x: hidden;
  overflow-y: auto;
}

which usually renders the same as

el {
  overflow-x: hidden;
  overflow-y: scroll;
}

because the auto value of overflow-y is scroll in most browsers.

So, in order to achieve this effect, we can’t use the overflow-x/overflow-y properties. I’ve experimented with the clip property as a potential alternative, but no luck so far: http://jsfiddle.net/qvEq5/

Leave a Comment