Create-a-media-query

Tell us what’s happening:
I’m a little confused. I created a media query, and one of the tests (that realistically looks at both criteria) is showing as passed, but the other fails (even though it is checked in the first test as well). Help. I feel like I’m missing something simple.

The test that passes: Your p element should have the font-size of 10px when the device height is less than or equal to 800px.

The test that fails: Declare a @media query for devices with a height less than or equal to 800px.

Your code so far



<style>
  p {
    font-size: 20px;
  }
  
  /* Add media query below */
  @media (max-height: 800px ) {
    p {
     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 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36.

Link to the challenge:

1 Like

Guys, I figured it out. I had a space after the “800px” in my media query. :man_facepalming:

If any one else can’t pass the test here, make sure there’s no spaces in the media query.

5 Likes

I figure out why it wasn’t working for me, hope it can be of help to someone else too.
I wasn’t including the “p tag” in the curly brackets under the media query.

<style>
p {
font-size: 20px;
}

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

</style>
6 Likes

thanks a lot i had 20 mins trying to figure this out…

You shuld set Chrome as 10px。

8 Likes

This is the exactly what I met during my study and the right way is set the correct min font size of my chrome borwser.

Nice, man!
Thank you so much!

thank you it worked <3

it solved my problem,thanks

Really really thank you

fantastic! thank you!

It works buddy! Thanks a lot!

It works, bro!
Thanks a lot!

Finally, correct answer. Thanks pal! Previously I didn’t use
/* Add media query below */ and didn’t put ; after 10px

Phew.

still have the same problem :worried: :worried:

Your p element should have a font-size of 10px when the device height is less than or equal to 800px.

Thanks alot this helped me so much

In my case,


@media (min-height: 800px) {

/* CSS Rules */ It’s working after remove this

p{font-size: 10px;} }

1 Like