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

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!