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
Lidija Novakovic
6,634 PointsConfused and need some explaining
Greetings and thanks for providing this great site and service. You are the best - period!
Now I am having some problems understanding some things in CSS. I walk through all your lessons and tutorials, but when I try to do things on my own - its like a blank white wall. I am getting stuck everywhere.
Questions: Why and when to use positioning and when to use margins?
On site Smells Like Bakin the nav has a top padding of 120px....but why padding and not margin-top?
On site Smells like Bakin' site I want to add a search-box the correct way above the menu but what ever I do things gets broken - reasons unknown. How do I add a search form in the upper right corner above the menu?
Cheers!
2 Answers
Andy Crofford
9,959 PointsMargin vs Padding
Margin is outside the block element and padding is inside.
Use margin to separate the block element from other elements around it, use padding when you want to move the block element contents away from the edges of the element.
I would need to see some code on the other question in order to assist.
sergio savala
3,683 PointsThe easiest way for me that I found to get familiar with these issues was to setup just a plain ole grid. Than set everything inside that container and just add elements and see how everything pushes up against each other. I spent about 30 minutes doing this till I was comfortable with it.