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
William Titterton
10,960 Pointsusing position relavtive
Hey guys. just have a quick question regarding using relative positioning, Is it bad practice to use it all the time? Should I use padding and margins to do the majority of positioning?
1 Answer
Jeff Jacobson-Swartfager
15,419 PointsThere is nothing wrong with relative positioning. There is also nothing wrong with floats, or with flexboxes for positioning your content. However, each method has its own advantages and drawbacks.
You can learn more about the basics of the various positioning techniques in the CSS Layout Techniques course.
There will be a few things you'll want to keep in mind with any positioning method:
- The method's browser support & behavior across browsers
- The method's effect on the document flow
- Breakpoints that may need to be addressed with media queries
I hope that helps!
William Titterton
10,960 PointsGreat help, thank you.
Jeff Jacobson-Swartfager
15,419 PointsNo problem!
Thas Eagans
Courses Plus Student 2,533 PointsThas Eagans
Courses Plus Student 2,533 PointsIMO yes. You want your code to be effiecient. Use padding, borders, and margins, and then use positioning when you need to do specific tasks.
</TREagans>