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!

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 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