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
  • 35,693
  • 74
  • 215
  • 425
  • 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,345
  • 11
  • 37
  • 58
2

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,741
  • 2
  • 15
  • 32