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

May you please help me with this code challenge?

Could you post your code that you've tried for the tasks, or the exact issues you're having with the tasks?

5 Answers

It would be helpful if I knew where you started having trouble, but based on where you are I'll assume you already have a basic understanding of CSS

  1. select main-logo and main-nav's list items <li></li> and apply a float:left; (it's in the style.css)
  2. the reasoning for this second step is presumably covered in an earlier video, but obvoiusly we dont want that heading to be all broken. Add another class to the class property in <header class="main-header"> so that it becomes class="main-header group".
    • If you look at the stylesheet you will see .group:after {... } as opposed to .group {... }. That makes it apply to whatever is after any elements of the 'group' class.
    • The logo and nav are inside the header - not after it. The first element after it is <div class="primary col"> so that's where the clearfix styles will be applied.
  3. This should be pretty simple. add col to <div class="extra"> to make <div class="extra col">, then add some content kinda like the other gonna-be columns. (obviously they're not columns yet because they're not floating correctly, but we'll get to that soon I bet.)
  4. YEP, the three <div>s, (<div class="primary col">, <div class="secondary col">, and <div class="extra col"> ), are stacked on top of each other, just like the logo and nav buttons were before. Solution? Float them left, like before.
    • "But won't that mess up the who clearfix thing that made them behave like solid boxes?" Well no, because it didn't actually touch their float property, it's just made them stay rectangular. Now they'll be rectangles that can be on the same line.
    • "But won't the 'columns' just float next to my nav items?" No, because we didn't float <ul class="main-nav"> or <header class="main-header group"> so both of those elements will extend all the way left as far as they can go, and won't let any more elements sit next to them. +"But we did float the nav." No we floated the li's inside it, not the ul.nav itself. Besides the header it's inside would still take up the whole width of the page.

OK, I'm done guessing what your questions might be. Hopefully this helps.

So for the first one you need to float: left the .main-nav and .main-logo elements in CSS.

What about number two? Sorry, I have figured out number one. But, I am stumped on Number two.

Aaahhh it cut out all my corner brackets /< /> and everything between.

I need help with the second one.

2 revisited: After you float the logo and nav to the left (in #1) part of the top bar and some of the content are jumbled. In the stylesheet there's a a style-rule already created that is used to solve these problems, a 'clearfix' that will force an element to be rectangular, as opposed to wrapping itself around other elements like a silly balloon animal. Otherwise floated elements will just fill whatever space they can find, and they'll morph themselves to fit into those spaces.

That rules selector is .group:after and it will apply to elements that follow .group elements. This will cause the column/divs (the ones that will be content columns later) to stay rectangular in shape.

So add group to <header class="..."> so that it looks like <header class="main-header group">