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 How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

Steve Isaacs
Steve Isaacs
2,112 Points

My 2-column responsive changes don't look like the video

In this video, Nick had us change the about page to show content in 2 columns. I've A/B'd with his code and it seems exactly the same, but on the About page, my image and copy don't stack, and on the contact page (from the last video), the contact details stacks under the general information, but shows as right justified, not left. What gives?

Screen: https://www.evernote.com/shard/s3/sh/a58d753d-08b7-4978-9201-65ac43db2197/061e535e7378a081b3c68556c87d740e

4 Answers

In your code, you are closing your first media query after

@media screen and (min-width: 480px) {

  /*****************************
  TWO COLUMN LAYOUT
  *****************************/

  #primary {
    width: 50%;
    float: left;
  }
}

If you remove that second curly brace and place it after your responsive code, it should work.

Add your second curly brace after this:

 /*****************************
  PAGE: ABOUT 
  *****************************/

.profile-photo {
  float: left;
  margin: 0 5% 80px 0;
}
Alan Johnson
Alan Johnson
7,625 Points

If I had to guess, I'd say you have float: left on your image. Can you post your code?

Steve Isaacs
Steve Isaacs
2,112 Points

Yeah, I do - but that what he had us do in the video.

css

@media screen and (min-width: 480px) {

  /*****************************
  TWO COLUMN LAYOUT
  *****************************/

  #primary {
    width: 50%;
    float: left;
  }
}

#secondary {
  width: 40%;
  float: right;
}


  /*****************************
  PAGE: PORTFOLIO 
  *****************************/

  /*****************************
  3 x 5 = 15
  100% - 15% = 85%
  85 / 3 = 28.333333333
  *****************************/

#gallery li {
   width: 28.3333%;
}

#gallery li:nth-child(4n) {
  clear: left;
}

 /*****************************
  PAGE: ABOUT 
  *****************************/

.profile-photo {
  float: left;
  margin: 0 5% 80px 0;
}


@media screen and (min-width: 660px) {

/*****************************
HEADER
*****************************/

nav {
    background: none;
    float: right;
    font-size: 1.125em;
    margin-right: 5%;
    text-align: right;
    width: 45%;
  }

#logo {
    float: left;
    margin-left: 5%;
    text-align: left;
    width: 45%;
  }

  h1 {
    font-size: 2.5em;
  }

  h2 {
    font-size: 0.825em;
    margin-bottom: 20px;
  }

}
Tricia Martin
Tricia Martin
19,604 Points

I think your problem may be a misplaced closing curly bracket after your #primary selector. Delete that curly bracket and move it to after the #profile-photo selector.

@media screen and (min-width: 480px) {

  /************************************
  TWO COLUMN LAYOUT
  *************************************/
  #primary {
    width: 50%;
    float: left;
  }


  #secondary {
    width: 40%;
    float: right;
  }

  /************************************
  3 * 5 = 15  Margin
  100% - 15% = 85%
  85% / 3 = 28.3333333333%
  *************************************/



  /************************************
  PAGE: PORTFOLIO
  *************************************/

  #gallery li {
    width: 28.3333%
  }

  #gallery li:nth-child(4n) {
    clear: left; /* Clears row so items sit nicely in rows */
  }


  /************************************
  PAGE: ABOUT
  *************************************/

  .profile-photo {
    float: left;
    margin:0 5% 80px 0;  
  }
}