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 CSS Foundations The Box Model Width, Height and Overflow Properties

Hira Javaid
Hira Javaid
1,677 Points

overflow:scroll declaration seem to be correct yet giving an error

Hello,

In the challenge question, it asks me to

Challenge task 5 of 5 Finally, add an overflow property that automatically provides scrollbars if and where they are needed.

And I am using this block of code:

div { box-sizing:border-box; max-height:150px; overflow:scroll; }

It seems to be working correctly when previewed, but the code checker is giving it wrong with the error:

** Bummer! Check the overflow declaration in your CSS.**

Is it a bug, or something wrong with the declaration, could anyone please help! Thanks.

1 Answer

Kevin Kenger
Kevin Kenger
32,834 Points

Hey Hira,

Try using overflow: auto;. That provides scrollbars only when they're needed. When using overflow: scroll, the scrollbars appear even if the content fits into its container and doesn't need to be scrolled.

Hira Javaid
Hira Javaid
1,677 Points

Aha! So, the " if and where they are needed" were the keywords :) Thanks so much!