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 trialJay Guillermo
1,305 PointsWhen 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
arsalan khan
Python Web Development Techdegree Student 5,670 PointsHi 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
21,978 PointsHi 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
Jay Guillermo
1,305 Pointshttps://teamtreehouse.com/workspaces/16414862#
here is my workspace.
Christopher Parke
21,978 Pointsprimary,
secondary {
display: block; Width: 90%; }
@media screen and (min-width: 480px) {
primary {
width: 50%;
Float: left;
}
secondary {
width: 40%;
float: right;
}
}