11

In css, is there a rule(s) to make the x-scrollbar always hidden, but make the y-scrollbar show only if it goes past the page (i.e. only show if needed)?

Thanks

omega
  • 40,311
  • 81
  • 251
  • 474
  • possible duplicate of [CSS hide scroll bar if not needed](http://stackoverflow.com/questions/18716863/css-hide-scroll-bar-if-not-needed) – Dave Jarvis Nov 24 '14 at 20:09

2 Answers2

15

Try this:

body{overflow:hidden;overflow-y:auto;}
codingrose
  • 15,563
  • 11
  • 39
  • 58
3

this will apply to all element . so no probability of horizontal scrollbar

*{
overflow-x:hidden;
}

for the y use the element u want

body{
overflow-y:auto;
}

you can use any other div if u want

Anobik
  • 4,841
  • 2
  • 17
  • 32