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 CSS Layout Techniques Positioning Schemes Absolute Positioning

Manuel Meewezen
Manuel Meewezen
8,627 Points

Float or Positioning?

Ok, what I have understood so far is there are several ways to build your colomns of your website; using float or by positioning. But which one should I use when actually building my website? What is the best method?

1 Answer

Brian Goldstein
Brian Goldstein
19,419 Points

The problem is, there's no right answer. some elements need to be floated, and some need positions, and some need both.

If you're using Bootstrap or Foundation as a starting point for example, some of this has already been decided for you - they have their own grid systems which make layouts as easy as appending certain class names to the elements in your markup.

If you're not using a framework, you can make it anyway you wish. There's the venerable 960 grid system (https://www.960.gs) as another solid starting point. A lot will depend on your design as well. Just remember that all floats remove elements from the document flow, as does absolute positioning. Try to figure out, based on the design, what properties you'll need before you code anything.

Prep, Plan, Perform, Perfect.

Good answer Brian!


Very good answer Brian