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

Display to inline-block? Help!

Hello, I am currently making a Code Challenge and I can't pass. I don't know how to solve this:

"Select the list items inside the nav element and set their display to inline-block."

This is what I did, but it doesn't work:

  nav ul {
  margin: 0 10px 0 10px;
  padding: 0;
  list-style: none;
  display: inline-block;
}

How do I need to write it correctly? I can't find anything on google which works for me. Thanks!

7 Answers

It asks you to select - Select the list items inside the nav element

the selector for a list item is 'li'

Hi Linus,

You were close. I find that taking good notes and watching the videos more than once is helpful for me. I hope this helps you.

nav ul {
  margin: 0 10px 0 10px;
  padding: 0;
  list-style: none;
}
nav li {
  display: inline-block;
}

nav li { margin: 0 10px 0 10px; padding: 0; list-style: none; display: inline-block; }

changed the UL to IL

Add nav li nav li { margin: 0 10px 0 10px; padding: 0; list-style: none; display: inline-block; }

You will need to create a new nav element that allows you to select items from the list, don't cram them all into the nav ul { ;;info }. Create a new nav element with the selector for a list like what was previously mentioned. So:

nav li { display: inline-block; }

should work.

nav ul {
  margin : 0 10px;
  list-style : none;
  padding: 0;
}

nav li {
  display : inline-block;
}

You are currently selecting the UL element. Without giving you the answer, read the question over to see what it is specifically asking you to select.

Hope this helps.

I tried it for 20 minutes with every thing, can you please help me a bit more? I am a beginner in the HTML and CSS stuff