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 How to Make a Website Styling Web Pages and Navigation Style the Image Captions

Edward Poon
Edward Poon
9,313 Points

Not sure how float works...

Hi,

I am a little confused as to what and how float works. I understand that the width is what makes displays two pictures per row. You said that float allows things to such as words float around the picture but I don't understand that... What is the point of float?

1 Answer

James Finn
James Finn
7,055 Points

By default, elements are rendered by the browser in the order in which they appear in the markup, aka "source order". The css float property can be used to remove an element from this normal document flow, positioning it within its containing element. However, unlike the position property, the float property allows other elements within the same parent container to wrap around the floated element. This can be ideal for images, for example, where text in a sibling p tag can wrap around the image. (Just think of text-wrapping in Microsoft Word).

I will once again defer to the master.