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

pietro capriata
18,066 PointsWhat are the difference between "top - margin-top" "bottom margin-bottom"?
Have not the same results?
1 Answer

Henry Goh
20,201 PointsHi Pietro,
The
top
attribute basically defines the y-position from the top of the browser, but also depends on what is defined in the
position
attribute as well.
The
margin-top
specifies the element's top gap from another element.
Same thing goes for bottom
where it starts counting the pixels or whatever units defined from the bottom, and margin-bottom
defines the gap below the element.
Do correct me if I am wrong though, as I am not really an expert in front-end web development.
You can check out a better Explanation here. Or the W3School where you can just experiment with the CSS editor.