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

scrollbar

Finally, add an overflow property that automatically provides scrollbars if and where they are needed.where am i wrong

index.html
<!DOCTYPE html>
<html>
<head>
    <title>Width, Height and Overflow Properties</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>   
    <nav>
        <a href="#">About Me</a>
        <a href="#">My Work</a>
        <a href="#">Contact Me</a>
    </nav>
    <div class="main">
        <p>Veggies sunt bona vobis, proinde vos postulo esse magis kohlrabi courgette sorrel rock melon summer purslane soybean bitterleaf fennel.</p>
        <p>Pumpkin ricebean gourd cauliflower water chestnut garlic parsley bunya nuts earthnut pea tomato lettuce. Swiss chard chickpea burdock soybean soko cucumber garlic wakame pea arugula azuki bean turnip greens spinach eggplant.</p>
        <p>Arugula cress bitterleaf rutabaga potato burdock celery chard eggplant desert raisin.</p>
    </div>
</body>
</html> 
style.css
/* Complete the challenge by writing CSS below */
a{
  display:inline-block;
  width:100px;
}
div{
  box-sizing:border-box;
  max-height:150px;
  overflow:  scroll;
}

1 Answer

geoffrey
geoffrey
28,736 Points

It's normal, if you read carefully the instructions it asks you to set the property and the value that are going to display a scrollbar, where they are needed.

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

You need to use the auto value in this case, this way, if ever the text inside the .main div is taller than 150px which is the max height of the div, there will be a scroll bar, if not, there won't be one. Hope I could help you.