Why @media query did not work here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0
30th Jul 2020, 7:51 AM
Pankaj Kumar
Pankaj Kumar - avatar
4 Answers
+ 1
1. Go to https://code.sololearn.com/W1MYyWw5SA8U/?ref=app#css 2. Scroll to the bottom. 3. Look at your media query code closely. Look at the indentation and areas. Sololearn's editor shows them as dots for me and you should see them too. They look like this: @media only screen and (max-width: 400px).{ ...body.{ ......background-color:.lightblue; ...} } Just to be very clear, you don't have period characters in your code. I used periods above so it would look similar in this other font. Those dots indicate that you have invalid whitespace characters. They show as dots mainly because of Sololearn's specific font but those characters will not have the ASCII code corresponding with a regular space or tab.
30th Jul 2020, 4:02 PM
Josh Greig
Josh Greig - avatar
+ 1
Look at it in Sololearn's code editor and you'll see why. You have invalid whitespace characters in your CSS around your media query. Sololearn's code editor draws these invalid characters as dots. I replaced the invalid characters with regular spaces and the media query works now: @media only screen and (max-width: 400px) { body { background-color: lightblue; } }
30th Jul 2020, 2:58 PM
Josh Greig
Josh Greig - avatar
0
Didn't understand
30th Jul 2020, 3:08 PM
Pankaj Kumar
Pankaj Kumar - avatar
0
Got it, thanks for explaining.
31st Jul 2020, 6:10 AM
Pankaj Kumar
Pankaj Kumar - avatar