Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Hide scrollbar.

Hi,

My box looks exactly the same as yours. Everything in CSS is also the same. The only thing is my scrollbar doesnt hide when I don't use it. How can I fix this? My overflow is also on auto. I already tried the other overflow settings.

We can't tell without seeing the code :)

3 Answers

If you want to hide the scroll bar you should use this:

body {
    overflow: hidden;
}

This is to hide just the horizontal

body {
    overflow-x: hidden;
}

This is to hide just the vertical

body {
    overflow-y: hidden;
}

Oh I tought that my question would appear under the video. It was the CSS Boxmodel workshop.

This is the code:

.box { width: 90%; height: 300px; max-width: 600px; padding: 20px; border: 2px solid black; margin: auto; overflow: auto; box-sizing: border-box; }

Thank you. But then it doesn't appear anymore when needed, like in the video.