Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is my media query not working as intended?

I’m trying to get some rudimentary media querying to work, but for some reason the div using the class "container" isn’t working on the media query using max width:1200px and min width: 992, it just dissapears from page when I enter that size. I have a very simple example set up and I don’t understand why the div just dissapears when I enter that size? It works for the three other sizes just fine.

Am I missing something simple?

@media screen and (max-width: 768px) {
    .container {
        width:100%;
        border:solid 1px black;
        height:300px;
    }
}

@media screen and (max-width: 992px) and (min-width: 768px) {
    .container {
        width:100%;
        border:solid 1px red;
        height:300px;
    }
}

@media screen and (max-width: 1200) and (min-width: 992px) {
    .container {
        margin:auto;
        width: 800px;
        border:solid 1px green;
        height:300px;
     }
}

@media screen and (min-width: 1200px) {
    .container {
        margin:auto;
        width: 1000px;
        border:solid 1px blue;
        height:300px;
     }
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this,

@media screen and (max-width: 768px) {
    .container {
        width:100%;
        border:solid 1px black;
        height:300px;
    }
}

@media screen and (max-width: 992px) and (min-width: 768px) {
    .container {
        width:100%;
        border:solid 1px red;
        height:300px;
    }
}

@media screen and (max-width: 1200px) and (min-width: 992px) {
    .container {
        margin:auto;
        width:800px;
        border:solid 1px green;
        height:300px;
    }
}

@media screen and (min-width: 1200px) {
    .container {
        margin:auto;
        width: 1000px;
        border:solid 1px blue;
        height:300px;
     }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading