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 Techniques Grid Layout Creating the Grid Container

Why do we need 2 classes in the Clearfix?

I wonder why Guil needs another class (.grid-container:after) in the Clearfix? Looks like an unnecessary addition to me. Isn't just using the .group enough? If I was on my own, I would just use the existing .group like this: <div class="grid-container group"> Will this work?

Ooops I mean like this:

<div class="grid-container group">

1 Answer

Mat Linski
Mat Linski
6,533 Points

Guil has explained it at the end of the video:

Finally, since we're floating our columns, we'll need this group Clearfix class to clear our floats. That way the grid container won't collapse. So, what we'll do is add a grid container after pseudo-element, to this Clearfix rule. THAT WAY IT'S ALREADY BUILT INTO OUR GRID. BUT WE COULD STILL USE THE GROUP CLASS SEPARATELY, IF WE NEEDED TO.

Thank you Mat, it's clearer now. I've missed that bit from the video.