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

Jake Adam
Jake Adam
9,226 Points

Help with this code challenge please

a { display: inline-block; width: 100px; }

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

What is wrong with the overflow declaration?

4 Answers

Guy Noda-Bailey
Guy Noda-Bailey
18,837 Points

Try setting it to auto instead;

.main {
  box-sizing: border-box;
  max-height: 150px;
  overflow: auto;
}
kevin jordan
kevin jordan
11,353 Points

Hey Jake -

This is a trick question kinda. Although the question in the challenge asks you to use overflow:scroll; it also asks you to set it up to be used ONLY if necessary. In cases like this you need to use the alternative overflow:auto; which will only add the scrolls IF needed.

Hope this helps !

Yea I believe kevin Jordan & Guy Noda-Bailey are correct!

.main {
  box-sizing: border-box;
  max-height: 150px;
  overflow: auto;
}
Jake Adam
Jake Adam
9,226 Points

Thanks so much guys!