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 Layout Basics Controlling Layout with CSS Display Modes CSS Display Modes Challenge

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

can see whatยดs worng here..help please

checking other answer, i got the correct one, but i can not pass.

style.css
/* Complete the challenge by writing CSS below */

header {
  text-align: center;
}
.logo {
  width: 110px;
  margin: auto;
}
.main-nav {
   display: inline-block;
}
index.html
<!DOCTYPE html>
<html>
<head>
    <title>Getting Started with CSS Layout</title>
    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
    <body>
    <div class="container">
        <header>
            <img class="logo" src="city-logo.svg" alt="logo">
            <ul class="main-nav">
                <li><a href="#">Ice cream</a></li>
                <li><a href="#">Donuts</a></li>
                <li><a href="#">Tea</a></li>
                <li><a href="#">Coffee</a></li>
            </ul>
        </header>
    </div>
    </body>
</html>

5 Answers

Steven Parker
Steven Parker
229,745 Points

The instructions say to set the display for "the list items inside .main-nav", but this CSS rule is targeting the main-nav itself.

When you submit this code, you should get this reminder message: "Bummer! Make sure you're selecting the list items inside '.main-nav'."

Hint: This would be a good place to use a descendant selector.

Gonzalo Torres del Fierro
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

1/3Display the list items inside .main-nav side by side. Use the display value that generates a block element that flows with surrounding content.: answer: .main-nav li { display: inline-block; } 1/3 </ok>

2/3The <ul> with the class main-nav is a block-level element by default, so it takes up the full width of its container. Let's set .main-nav to be as wide as the content inside it. Change the display of .main-nav to the display value that generates a block element that doesn't take up a full line.

here I got the problem.... I tried (1): .main-nav { display: inline-block; }

I tried (2): ul.main-nav { display: inline-block; }

I tried(3): .main-nav ul { display: inline-block; }

so I'm getting confused.

Steven Parker
Steven Parker
229,745 Points

For task 2 you do want to target "main-nav" itself, so "I tried (1)" should work (same as what you had to start with).

Did you add that with the task 1 code? Or did you accidentally erase the code for task 1?

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

finally the answer:

.main-nav li { display: inline-block; } .main-nav{ display:inline-block; }

Steven Parker
Steven Parker
229,745 Points

Right. Each task in a multi-task challenge must remain as the other tasks are added to it.

Since these are setting the same value, another solution would be:

.main-nav li, .main-nav {
    display:inline-block;
}

woaah ur a pro now

Paul Olivarez
PLUS
Paul Olivarez
Courses Plus Student 8,881 Points

i am having problem getting this question right are there anyone can help me? .more { display: none; }

header { text-align: center; } .main-nav { width: 110px; margin: auto; }

.logo { display: block; }

.main-nav { display: inline-block; }

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

3/3 The logo is an <img>, so it displays inline with surrounding content by default. The logo displays on the same line as .main-nav and the auto margins have no effect on it. Place the .logo on a separate line by changing its display mode.

i tried 1 : .logo { display:inline; }

i tried 2 : .logo { display:inline-block; }

I can not get it, may be today is not my best day to get on it...