I encountered a problem when coding in media queries CSS. My @media typing in Visual Studio Code is not functioning right like in every other computer. The screenshot im leaving here, I have 8 problems appear in my index.html file and even though I code right with the documentation, the problem contunies. How can I solve this?
Black background is what my teacher’s, it needs to be like this
White background vs is my base
I did not try antthing
>Solution :
As Paulie_D said the question needs a minimal reproducible example. This helps other to identify the problem faster and to get better answers.
But the difference between the example media query and yours are the missing {} for the media query, which wraps the demanded selectors.
body {
background-color: aquamarine;
}
@media (min-width: 319px) and (max-width: 480px) {
body {
background-color: lightsalmon;
}
}
@media (min-width: 481px) and (max-width: 1200px) {
body {
background-color: powderblue;
}
}
@media (min-width: 1201px) and (max-width: 1600px) {
body {
background-color: limegreen;
}
}
@media (min-width: 1601px) {
body {
background-color: seegreen;
}
}