My understanding of media queries is that they don't have specificity, meaning any matching css rule placed after them in the document even if it doesn't use a media query will take precedence over the media query.
If you can't place your css after the media query then you have to either use a higher level of specificity, or an !important tag.
So if the emdia query is something like:
@media only screen and (prefers-color-scheme: dark) {
p {
color:red
}
}
you can override that with any of the following…
p.classname {
color:blue
}
section > p {
color:blue
}
p {
color:blue !important;
}
Someone correct me if I'm wrong!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My understanding of media queries is that they don't have specificity, meaning any matching css rule placed after them in the document even if it doesn't use a media query will take precedence over the media query.
If you can't place your css after the media query then you have to either use a higher level of specificity, or an
!important
tag.So if the emdia query is something like:
you can override that with any of the following…
Someone correct me if I'm wrong!