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 triallarateles
Courses Plus Student 1,428 Pointswhat are the best practices?
When it comes to website layouts and positioning, what are the best practices? There are a number of ways to do it I think, and I'm never sure which way is THE BEST way. Whether it's using margins and padding, relative or absolute positioning, grids or even Flexboxes. Can someone let me know what is considered the current "best" way to setup layouts. Especially for cross-browser compatibility and responsive layouts.
1 Answer
myackley35
34,574 PointsHey!
You are correct in the fact that there isn't a wrong way to style something with CSS. As long as you're meeting the requirements that are set (personal expectations or project requirements) you should be good, however, you might not always agree with what is the best method in the project scenario.
A lot of what is considered "best practice" is implemented in CSS frameworks as far as floating elements and applying margins/padding go. If you're curious I would recommend starting there. Another thing you will have to be aware of is best practices regarding how you format, etc. your code since someone will wind up working with your code again at some point. Here's some good CSS guidelines that can help you out. It would be worth your time also to check out Guil's badge on Sass and BEM in Modular CSS.
I hope this helps!