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

HTML How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

Two Column Layout not becoming a one column layout at 480px

I am trying to get my page layout to be one column when viewed in a smaller screen, but its not working.

Here is the code:

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

/*******************
Two Column Layout
********************/
  #primary  {
    width: 50%;
    float: left;
  }

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

/******************
Page: Portfolio
********************/

#gallery li {
    width: 28.3333%
  }

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


/*******************
Page: About
********************/

/*Two Column Layout*/

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

}
Ken Alger
Ken Alger
Treehouse Teacher

Edited for markdown format.

Ken Chung
Ken Chung
1,821 Points

You could change your width % to get one column layout.

2 Answers

I had this problem (the page would stay in two columns and never float the image to one column layout when sizing the screen very small). Finally I figured out that I had closed my curly brackets from the 480px media rule before including the section for the About page. Once I moved the closing curly bracket below the About page section, it fixed the problem.

CJ Jugarap
CJ Jugarap
2,517 Points

Had a text wrapping issue and moving the curly bracket to close off the 480px media rule to the very end worked.

Doug Ray
Doug Ray
7,493 Points

Currently your only setting each list item to have 23% width leaving space for the other elements to fill which is why you get the two column layouts, try increasing the width of a single list item until they break to the next line