Can you tell me how to solve this?

Tell us what’s happening:
are my code wrong?
can you tell me how to solve this?
" Your p element should have an initial font-size of 20px when the device height is more than 800px."

Your code so far


<style>
@media (max-height: 800px){ 
 p {
   font-size: 10px;
 }
}
 /* Only change code below this line */
 @media (min-width: 800px){
p {
 initial-font-size: 20px;
}}
 /* 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; rv:78.0) Gecko/20100101 Firefox/78.0.

Challenge: Create a Media Query

Link to the challenge:

I recommend jsfiddle to find errors: Edit fiddle - JSFiddle - Code Playground

image

1 Like

thank you. :grinning:

It appears you have changed a part of the code that you are not supposed to change.

In any case, you are required to " 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."

You should therefore define a media query for when the maximum height is 800px, ie:

@media (max-height: 800px) {
//rules
}

if this is not clear I’m happy to assist.

1 Like

thank you for your kindness sir.But the code still wrong, i have tried your solution but it still wrong sir.Do you has other advice?

This part is wrong. It should be:

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

As far as i know, there’s nothing like initial-font-size property in CSS. plus font-size was highlighted in the instruction…

1 Like

Thank you for your kindness.

1 Like

Did you pass the challenge yet?

no i didn’t pass the challenge. I think there is something wrong with my network.

post your last code

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

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

@media (min-height: 800px){
p {
 ifont-size: 20px;
}}

is that your whole code?

first, there is not such a thing as ifont-size, it must be font-size
other than that you are missing a part of your code

1 Like

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

3 Likes

thank you for your advice. I have done the responsive web design challenge.

thanks for your hint sir.