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 Build a Simple Website Creating a Website Structure Working with Grids

Kelly Bauman
Kelly Bauman
1,582 Points

Adding grids...

Hi there. Apologies in advance for what's probably a simple questions, but I'm wondering why adding the first grid_4 div caused the nav and text to flow around the banner? I'm under the impression that using a div element should force a new line in the document? In this case, it's producing the opposite effect?

3 Answers

Kelly Bauman
Kelly Bauman
1,582 Points

Apologies; obviously it has to do with the clearfix class applied to the container. Is there an "anatomy of the clearfix class" in future lessons? :-)

Oscar Perez
PLUS
Oscar Perez
Courses Plus Student 15,046 Points

Hi Kelly, let me try to answer your question, A simple div is a block element that will expand to force a new line in the document, but when adding a class to your element for example class="grig_4", this class may have some properties that will define a width on your div and will have float property that will flow your text around the banner. So this is why adding the first grid_4 flows your div around the banner. Now the clearfix class in simple words is kind of stoping this flow in your text or divs. Its letting the browser know that the rest of the elements should not flow and at the same time letting the browser know that some elements are floated. If your just starting in css this will be explained in detail in future lessons. I hope i answered your question or put you more in trouble hahaha. Cheers

Kelly Bauman
Kelly Bauman
1,582 Points

Oscar, thank you so much! i'm pretty new to all of this, and the simple things still get me. I just noticed that there's more exhaustive grid learning down the track, and am excited for it.

Again, thanks. Getting to know classes is opening my eyes to hierarchal imposition of styles; I think that's what your response speaks to.

Cheers! Kelly