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

Ian Z
Ian Z
14,584 Points

Code Challange: floats 3 of 3

The question is "In the preview, notice how the floats made the parent container's height collapse. In the HTML file, give the .secondary-content div the specified class for clearing floats."

the css code is

.group:after {
 content: "";
 display: table;
 clear: both;
}

my edited html code is div class="group" with arrows around it and it errors Bummer! Make sure you're giving the 'secondary-content' div on line 9 the correct class for clearing floats.

3 Answers

Hi Ian,

Can't remember the challenge but can you try it with 2 semi colons please?

.group::after {
 content: "";
 display: table;
 clear: both;
}

This article from CSS Tricks may also help as a reference.

If that doesn't work can you post a link to the challenge please and I'll take a look? :)

-Rich

Alexander Daniels
Alexander Daniels
3,307 Points

I know this is 6 months old, but all you need to do is add group as a class to the <div> containing secondary-content

<div class="secondary-content t-border group">

The ::before and ::after pseudo-elements can be used to describe generated content before or after an element's content. It's effectively the same as the single-colon syntax defined by the level 2 spec. The level 3 spec introduces an extra colon to differentiate between pseudo-elements and pseudo-classes (which use a single colon).

Both syntaxes will work in newer browsers, but older browsers will not recognise the newer :: style.