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 How to Make a Website Styling Web Pages and Navigation Style the Portfolio

What does a margin of -5px do?

Please help?

2 Answers

Isaac Asante
Isaac Asante
4,752 Points

Hello Dhruv,

margin-top: -5px; will push your element further up by 5px, instead of pushing it down.

margin-right: -5px; will push your element further to the right by 5px, instead of moving it away from the right.

margin-bottom: -5px; will push your element further down by 5px, instead of lifting it up.

margin-left: -5px; will push your element further to the left by 5px, instead of moving it away from the left.

I hope you understand :)

Is it hard to tell what does -5px do? It will move backwards direction 5px.