0

I have a div that has a lot of content and hence scrolls.. How can I hide the scrollbar such that it is not visible. EDIT: I do want scrolling to work! So.. Scrolling with no scrollbar?

eg

.scrolling_div {

     overflow:auto;
     /*something else to hide the scrollbar?*/

}
2
  • It sounds like you want it to be scrollable without a scrollbar? That's how it came off to me... Commented May 1, 2012 at 22:29
  • @jay check my post and DEMO. Let me know how it goes. Commented May 1, 2012 at 23:11

6 Answers 6

4

Ok, I spent sometime to write minimal code.

Check DEMO. Mouse over the div and scroll to see the scroller.

Note that this using an external plugin to listen to mousewheel event.

DEMO page for the plugin


overflow:hidden should hide the scrollbar.

.scrolling_div {
     overflow: hidden;
}

overflow can take any one of the below values,

visible Default value. Content is not clipped, it may be rendered outside the content box.

hidden The content is clipped and no scrollbars are provided.

scroll The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment.Printers may print overflowing content.

auto Provide scrollbars if content overflows.

Reference

Sign up to request clarification or add additional context in comments.

Comments

2

overflow: auto; means "show a scrollbar if necessary". Change it to overflow: hidden; to disable scrolling.

EDIT: Okay, you want to make a custom scrollbar. Then see this sample jsFiddle for how to get started - it includes mouse wheeling and dragging of the scrollbar.

10 Comments

@jay: That's a little difficult, don't you think? How will the user scroll without a scrollbar?
i know it seems counterintuitive.. you would scroll either with a mouse that is thus enabled, or a custom scroll bar that i designed. this is very much a looks thing..
@jay You gonna need some javascript if you want to scrolling without default scroll bars.
@jay: I'm in the process of writing a script now, but tell me in advance if it only has to work on Chrome and Safari - those browsers make it incredibly easy to customize scrollbars.
hmmm well i'm looking for cross-browser solutions, so if it could be for IE/firefox as well then that would be awesome..
|
1

You can try this:

html {
        overflow: hidden;
    }

it will remove the scrollbar from all the window.

Otherwise if you need it only on a specific div:

.scrolling_div {

     overflow: hidden;

}

Comments

0

Use a wrapper which covers the element you want to be scrollable without a scrollbar, and let the wrapper be narrower than the element to scroll, in the horizontal basis. This is what I mean: http://jsfiddle.net/FlagelloDiDio/EdgTt/

Comments

0

It really depends on what you are going for. see here

overflow:hidden; may be what you want.

If you want to dip into css3, you can play with overflow-x and overflow-y for even more options.

Comments

0

The only way to hide the scrollbar is to make the content non-scrollable and just cut off if it exceeds the height (overflow: hidden). Honestly, why would you want to have a page that is scrollable that doesn't have a scrollbar? That would confuse the heck out of any visitors. There's no way you can do this with CSS.

As far as customizing the scrollbar, there are JavaScripts out there to do that. But make sure that if the user has it disabled, they can still properly scroll the page without it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.