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.

CSS Unused CSS Stages Media Queries Adaptive Layouts with Media Queries

James Male
James Male
6,619 Points

Floating an element left seems to be giving me trouble...

Under "Phones to Tablets," create a media query that floats the .col elements left if the viewport is 481px or wider. Then, add all other "Phones to Tablets" CSS rules inside the media query.

I am getting "Did you float your .col divs left"

Here is my code:

/* Complete the challenge by writing CSS below */

/* Phones to Tablets */

@media only screen and (max-width:481) {

div .col {
float: left;
}
.main {
    width: 65.957446808511%;
}
.secondary {
    width: 31.914893617021%; 
}
.extra {
    margin-left: 2.127659574468%;
}
}

/* Tablets to Desktop */

.main {
    width: 40.425531914894%;
}
.extra {
    width: 23.404255319149%;
}

2 Answers

Roberto Alicata
PLUS
Roberto Alicata
Courses Plus Student 39,959 Points

you are using the wrong condition in the media-query. You must use min-width:481px (remember to use the word "px" after the number)

James Male
James Male
6,619 Points

Thank you, I had no idea I missed out the px on the end! I had even swapped min-width and max-width a few times and still not spotted it.

Thanks,

  • James