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 CSS Layout Basics Page Layout with the Float Property Wrapping Text Around Images with Floats

Laly Singh
Laly Singh
2,029 Points

Why applying a margin to the p element don't work?

At 2.43 Guil says "Now, applying a margin to the paragraphs will not create the desired white space."

Why?

Is it because the floated element has an absolute position so it needs to have the margins applied to create white space?

1 Answer

Steven Parker
Steven Parker
231,248 Points

It's because "float" setting causes the image and the paragraphs to overlap.

He probably should have said "applying a small margin ...", because if you apply a large one (like 350px for example), it will create white space. But it will also defeat the effect of the text wrapping around the image.

That's why the better solution is to place a margin on the image instead of the paragraphs.