views:

391

answers:

3

How can the scrollbar be hidden? I want to do this because the scrollbar is not nice.

overflow:hidden is not useful, because my div element has many other elements.

So setting overflow does not solve my problem.

+1  A: 

You can hide it with this...

document.body.style.overflow = 'hidden';

However, you have to question yourself whether this is really what you want. Scrollbars appear for people to be able to view things that are outside of their small screens.

Marga Keuvelaar
A: 

You have to use the CSS property overflow, which 'manages' what should happen when the content of a certain element exceeds its boundaries. Setting it to hidden hides the scrollbars.

overflow: hidden;

or

someElement.style.overflow = 'hidden';
Douwe Maan
A: 

My eyes hurt when I read your question. However, it is impossible to hide the browser scrollbar without setting "overflow:hidden"(?!). It is a default browser behavior.

Since your div has many other elements why don't you set the proper width and height to it? Otherwise please make it scrollable so that the users can fully read your content.

zocoi