0
<div class="main">
<div class="content">
<div class="left_container">

</div>
</div>
</div>

In the code above, I have added a scroll to the left_container div. But I want to hide it! Referring to other questions and answer, I found out to set overflow:hidden in the parent div class.

But still the scroll is not hidden in the child class?

CSS:

.content
{
    background-color: white;
    width:100%;
    height:auto;
    margin-top:10%;
    position: absolute;
    overflow: hidden;

}

.left_container
{
    background-color:;
    margin-left:5%;
    margin-top:5%;
    width:70%;
    height:1000px;
    overflow:auto;
}

Well I have also tried to set it hidden in the body! still not working..?

12
  • if I get you right then you trying to remove the scroll, then removing 'position: absolute' from .content should work Commented Aug 22, 2015 at 6:21
  • I did, but the align and background div go missing! And also the scroll is not hidden even then! Commented Aug 22, 2015 at 6:22
  • i still could see background and scroll hidden, here is a fiddle jsfiddle.net/jac607zu Commented Aug 22, 2015 at 6:23
  • jsfiddle.net/0wLsqarL you can check my code here Commented Aug 22, 2015 at 6:26
  • Just trying to understand why would you do that, .left_container to have scroll and also wants to hide it? if you dont need a scroll on .left_container then have it overflow hidden. Commented Aug 22, 2015 at 6:37

3 Answers 3

0

There is actually a simple way.

.left_container { overflow: hidden }

Now give left_container a child div and apply the following styles

.left_container-child {
  height: 100%;
  overflow-x: scroll;
  width: 101%;
}

What this does is push the scrollbar out of sight.

You really want to check this over on differnet browsers and make sure you get the sweet spot that your content doesnt get cut off.

You can see a working example here (change the width on left_container-child to experiment pushing the scrollbar out). Example

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

4 Comments

Ohkk but in that example you showed, I can see the scroll, its not hidden!?
Like i said, change the width to push the scrollbar out of sight
example 2. I have set the width to 200% (just so you can understand). Cheers
Well thats nice! its working! I will have to somehow place it in my code! Ill mark u as answer just give me sometym
0

You have not used overflow:hidden in .left_container. Try:

.left_container {
    background-color:;
    margin-left:5%;
    margin-top:5%;
    width:70%;
    height:1000px;
    overflow:hidden;
}

2 Comments

If I add hidden, I am not able to scroll!
hiding the scrollbars while retaining scrolling ability seems to be full of pretty hacky solutions, here's another stack overflow answer that sheds some light on it: stackoverflow.com/a/25561646/3287366
0

I think can't hide scroll bar for overflow hidden content. you can try using scroll bar plugin http://nicescroll.areaaperta.com/demo.html

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.