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.

HTML How to Make a Website Styling Web Pages and Navigation Create a Horizontal List of Links

Mayank Sapra
Mayank Sapra
4,555 Points

How to change top and bottom margin to 0 and left and right margins to 10px?

In one of the code challenges related to CSS it has been asked to right the rule that changes the top and bottom margin to 0 and left and right margins to 10px wide. Is there anything wrong with this rule ?

nav li{ margin : 0 10px; }

3 Answers

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Apply this rule to unordered list:

nav ul{ margin : 0 10px; }
Tim Larson
seal-mask
.a{fill-rule:evenodd;}techdegree
Tim Larson
Full Stack JavaScript Techdegree Student 13,696 Points

Remember when setting margins it works in a clockwise orientation, meaning value 1 is top value 2 is right 3 is bottom and 4 left. Applying this concept you could potentially achieve your goal by setting

nav ul { margin: 0px 10px 0px 10px; } 

Good luck to you!

Mayank Sapra
Mayank Sapra
4,555 Points

Thanks Sergey and Tim it worked I realized I overlooked the question, it was unordered list I was supposed to write the rule for instead of ordered list.