Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Jay Guillermo
Jay Guillermo
1,305 Points

When I make window smaller, the Contact layout stays in 2 columns instead of going to 1 column for mobile.

I have added the media query:

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

}

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

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

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

However, when I make window smaller, the "Contact" page stays in 2 columns instead of going to 1 column for mobile.

4 Answers

Hi Jay,

You made a very simple mistake :)

you have put a condition that a code should execute if the condition of the media query is met (i.e minimum width of 480px) but when u put this condition only the code inside the curly brackets { //code goes here } will get executed

summary : put the code inside { } @media screen and (min-width: 480px) { // code here }

note : its actually a basic programming concept that when you write a condition and its true the code inside the curly bracketwill execute :)

Christopher Parke
Christopher Parke
21,978 Points

Hi Jay,

You should put the code below the media query inside it. Then you should make the primary and secondary elements have a width of 90% and display:block; as their display property

Christopher Parke
Christopher Parke
21,978 Points

primary,

secondary {

display: block; Width: 90%; }

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

primary {

    width: 50%;
    Float: left;
 }

secondary {

    width: 40%;
    float: right;
 }

}