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

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.