Why do media queries work like this?

Asked

Viewed 51 times

0

I was creating a responsive menu, and u noticed that if I don’t put the media queries from the smaller to the larger it doesn’t work properly.

@media only screen and (min-width:560px) {
    .menu li {
        width: 132px;
        height: 50px;
    }

    .menu li a {
        width: 132px;
        height: 50px;
        color: red;
        position: absolute;
        font: bold 18px Arial, Tahoma, Helvetica;
        display: -webkit-flex;
        display: flex;
        -webkit-align-items: center;
        align-items: center;
        -webkit-justify-content: center;
        justify-content: center;
    }
}

@media only screen and (min-width:960px) {
    .menu li {
        width: 132px;
        height: 50px;
    }

    .menu li a {
        width: 132px;
        height: 50px;
        color: #fff;
        position: absolute;
        font: bold 18px Arial, Tahoma, Helvetica;
        display: -webkit-flex;
        display: flex;
        -webkit-align-items: center;
        align-items: center;
        -webkit-justify-content: center;
        justify-content: center;
    }
}

1 answer

3


Browser other questions tagged

You are not signed in. Login or sign up in order to post.