Create a Media Query I copied and pasted and still wrong

Tell us what’s happening:

Your code so far


<style>
	p {
		font-size: 20px;
	}
	/* Add media query below */

	@media (max-width: 800px) {
		font-size: 10px;
	}
</style>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum
	cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst.
	Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat,
	nunc ligula ultricies diam, at aliquet velit libero a dui.</p>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/responsive-web-design-principles/create-a-media-query/

What you need is to define a new rule inside your @media for the <p> tag.
So look at the code for defining the

tag style and recreate it inside your media definition.
Hope this helps.

inside each media query @media (...){} you should override/define a css rule, your code as following:

@media (max-width: 800px) {
		font-size: 10px;
}

Doesn’t make sense, becasue override/define font-size for what?!

this could be something like following

@media (max-width: 800px) {//when screen is less then 800px
   .some_rule, another_tag{
        color:red;/*sample override/definition*/
   }
}

Now you know how to fix it, go for it.

Keep going on great work, happy programming

1 Like

hi hbar1st:
my code is:

p { font-size: 20px; } /* Add media query below */ @media (max-height: 800px) {p {font-size: 10px;}} }

and my browser is chrome, the code doesn’t work.
please help me out.

thanks.

Hey @JarryHua,
You have an extra curly bracket at end.

I deleted that curly bracket, It still doesn’t work.

p { font-size: 20px; } /* Add media query below */ @media (max-height: 800px) {p {font-size: 10px;}}

Can you provide you whole code along with html?

p { font-size: 20px; } /* Add media query below */ @media (max-height: 800px) { p{ font-size: 10px; } }

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst. Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat, nunc ligula ultricies diam, at aliquet velit libero a dui.

When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read.

thanks for your advice.


p { font-size: 20px; } /* Add media query below */ @media (max-height: 800px) { p{ font-size: 10px; } }

image

@JarryHua try this challenge in firefox browser and see if that helps .

firefox can pass it, chrome failed, why?

There is some issue of minimum font size.
You can now move on to next challenge.