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 trialStig Bratvold
4,120 PointsContent defined breakpoints - code challenge
Hi I am having some problems with this code challenge.
The first task says "Write a media query at 705px where the layout begins to break, that forces grid_1 through grid_6 to span 100% width of the container."
I add this code to the bottom of the styles.css but it does not work :(
/ *media-queries ------------ */
@media-screen and (max-width: 705px;) {
.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { width: 100%; }
}
What am I doing wrong?
1 Answer
James Barnett
39,199 PointsYour CSS selector is fine, the issue is with your media query itself.
Here's a syntactically correct media query, see if you can spot the 2 bugs in your code.
@media all and (min-device-pixel-ratio: 2)
For the really geeky among us, the general form of a media query is:
@media $_MEDIA_TYPE $_OPERATOR ($_FEATURE: $_ATTRIBUTE)
Where:
-
$_MEDIA_TYPE =
all
,screen
,projector
,print
etc -
$_OPERATOR =
not
,and
, andonly
-
$_FEATURE =
device-width
,max-width
,min-resolution
,min-device-pixel-ratio
,orientation
, etc
For even more details, you can read more about the syntax of media queries over at Sitepoint