Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website Styling Web Pages and Navigation Review: Styling Web Pages and Navigation

Marco Morales
Marco Morales
6,833 Points

Should "Which of the following CSS declarations will allow list items to appear horizontally?" have 2 possible answers?

The choices are:

  • display: inline-block;
  • display: none;
  • display: inline;
  • display: block;

Both "inline-block" and "inline" are correct, but "inline" gives a wrong response.

2 Answers

Isaac Asante
Isaac Asante
4,752 Points

Here, what you want is to have list items displayed inline with other elements, and each list item displayed as block items. So only "inline-block" is correct.

Marco Morales
Marco Morales
6,833 Points

Thanks. In the context of the exercises, "display: inline-block" is correct. But the question doesn't specifically ask anything that would limit the answer to inline-block. It only asks that list items appear horizontally. Both "display: inline" and "display: inline-block" would result in the list items being inline of each other horizontally. For this question to have only one possible answer, it should add another part that differentiates inline from inline-block, eg. width and height which was mentioned in the exercises.

Isaac Asante
Isaac Asante
4,752 Points

You can consider it as an exercise to memorize everything you saw in the video. So the video emphasized on inline and blocked li elements. This explains why the quiz is "forcing" you to select the inline-block answer. It's more beneficial to memorize inline-block which combines the profits of both values (inline and block), than inline only.