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 Foundations The Box Model Floats

Juan Luna
Juan Luna
11,483 Points

Question about Float and Clear property.

Hi, I did the Float exercise in my CSS course but when I tried to do the same a second time something went wrong: the paragraph isn't behind the H4, I tried to use the Clear property but doesn't work; I don't know what is the problem. This is the example:

Example

Thank you all.

3 Answers

Take out float:left under the H4 tag. I think that might be what you're looking for.

Juan Luna
Juan Luna
11,483 Points

Can you tell me why that fix the problem? Taking out float:left?

Thank you

Tim Knight
Tim Knight
28,888 Points

Juan,

I'd probably appreciate it a little differently. Since the image and the headline are both floated you're not going to be able to clear: left on paragraph because it'll just appear below the image. Instead float the image and then set a margin-left of a containing div that covers both the headline and the paragraph to a margin of the width of the image plus the padding.

Example

Everything was set to float left. The "Cro" title was short enough to fit everything on one line. The "Bombay Bicycle Club" title was longer so it broke to the next line. If the Cro title was longer you probably would never have noticed it.