1

I want to hide scrollbar, but at the same, i also want to have scrolling action i.e I want to hide scrollbar but still, want to scroll to see rest of content without actually seeing the scrollbar.

overflow: hidden won't work because after using that I cannot scroll to see the content.

how to do that using HTML/CSS/javascript?

I am working on styling scrollbar but I noticed there is no well-defined way to style scroll bar so I made custom scrollbar using divs with jQuery, but at the end, I have two scroll bar one which I made and other default scrollbar and now I want to hide default scroll bar.

I don't want to use -webkit- because it is not accepted in all browser.

I want to hide scroll bar in the following code.

		.container{
  width: 100%;
  background-color: #d5d5d5;
}
.sidebarcontainer{
  width: 300PX;
  height: 6000px;
  display: inline-block;
  box-sizing: border-box;
  padding: 5px;
  padding-right: 2px;
}
.innersidebarcontainer{
  position: relative;
      width: 100%;
    height: 100%;
}
.sidebar{
  width: 300px;
  background-color: teal;
  height: 2000px;
  top: 1px;
  position: absolute;
}
.mainpage{
  width: calc(100% - 300px);
  padding: 5px;
  padding-right: 2px;
  height: 6000px;
  display: inline-block;
  box-sizing: border-box;
}
.page{
  width: 100%;
  height: 100%;
  background-color: white;
}
.footer{
  height: 500px;
  width: 100%;
  margin: 0 auto;
  background-color: purple
}
<body>
  <div class="container">
    <div class="sidebarcontainer">
      <div class="innersidebarcontainer">
        <div class="sidebar">
        </div>
      </div>
    </div>
    <div class="mainpage">
      <div class="page"></div>
    </div> 
  </div>
  <div class="footer"></div>
</body>

please anybody answer!

2

4 Answers 4

2

And overflow:auto; is out of the question?

It won't show if you don't need but does show when you do.

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

Comments

1

You need to add the following styles:

#parent {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

#child {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    padding-right: 17px;
}

Here is the working fiddle: http://jsfiddle.net/5GCsJ/954/

1 Comment

could you provide the solution with respect to my code?
0

Make your scroll bar transparent. You can do this by the following code.

    ::-webkit-scrollbar
    {
        width:0px;
    }
    ::-webkit-scrollbar-track-piece
    {
        background-color: transparent;
    }

Hope this will help you!

Comments

0

Try this:

yourDiv::-webkit-scrollbar{
    width: 0px;
}

1 Comment

Works only for webkit based browsers

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.