I am trying to move the media queries in my css file to a separate css file and then import it in the first file
File 1 : main css file
@import url("mediaqueries.css");
.main-nav{
height: 40px;
position: fixed;
display: flex;
width: 100%;
background-color: rgb(80, 80, 80);
align-items: center;
z-index: 1000;
}
File 2: mediaqueries.css
@media only screen and (max-width: 790px) {
.main-nav {
display: none;
background: red;
}
}
But when I do this. Once the media is triggered, its CSS properties are getting overridden by the original. (See below screenshot, display:none is getting overridden)
I tried moving the import to the end of the file. But then the media query is not getting triggered at all.
What is the correct approach to move your media queries to another css file and then import it in your first css file?