Media query styles problem?

"Add a media query, so that the p tag has a font-size of 10px when the device’s height is less than or equal to 800px . "
can anyone tell me how to add the following media query/styles as being said above.

  **Your code so far**

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

/* Only change code below this line */

/* Only change code above this line */
</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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36

Challenge: Create a Media Query

Link to the challenge:

Hi @MohitJain,

Media queries are not exactly properties as background for example. They are rules themselves. I suggest you to watch the example in the course again to see how they work. I put you an example inspired from the course:

@media (max-width: 100px) { 
  /* CSS Rules */ 
  p {
    color: black;
  }
}

This article can be a helpful addition to the Course Work:

Media Queries can seem a little difficult to understand at first, but are relatively easy to gain proficiency in, and are Extremely useful once they have been Mastered:


thanks LucLH !!! it worked…

Thanks ALLESS it was helpful…

1 Like

Glad that you figured it out @MohitJain :wink:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.