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.

CSS

Ingrid Bardales
Ingrid Bardales
10,616 Points

offstets vs. margins

Hey guys, i noticed the offsets top, bottom, right and left are used with positions such as relative and absolute, so my question is do we use the offsets with these types of positions instead of margins?

Thanks in advance

Ingrid

2 Answers

Ingrid,

All in all, it really depends on what you're trying to accomplish with your CSS. Offsets are used for exactly positioning an element rather than margins that are used for spacing around the element via the box model. Margins are used for more general positioning (text, images, etc.) whereas offsets are used for more advanced applications (exact positioning of elements outside of a parent element, etc.)

I hope this helps!