How can I fix @media max-width issue in html and CSS?

27 views Asked by At

I was trying to command screen using css but it I'm getting errors...

I was trying to use @media (max-width: 858px;) but no matter how hard I try it keep showing error mark and the code will not work

Screenshot Below

Hi, I was trying to command screen using css but it I'm getting errors...

I was trying to use @media (max-width: 858px;) but no matter how hard I try it keep showing error mark and the code will not work

Screenshot Below

1

There are 1 answers

0
Michi.L On

The issue might be, that you have semicolons inside this brackets. they are not required, or by my knowledge even allowed, since you are not supposed to have multiple conditions in between brackets.

So it should be:

@media (max-width: 858px)

If you want to have multiple conditions, you put them in individual brackets and use the "and" operator:

@media (max-width: 858px) and (min-width: 700px)

So semicolons are not part of the syntax.

In your screenshot the second error hints probably to an additional mistake, that you have "-width", which is not a valid property. This should be "width".