Skip to content Skip to sidebar Skip to footer

Mediaqueries Max-width Not Working In Firefox

I want to use a mediaquerie for max-width. It works fine with Chrome but in Firefox it does not, why? jsfiddle code CSS .box { width: 150px; height: 150px; background-c

Solution 1:

Your syntax is wrong, you need a space between and(max-width)

See below

@media screen and (max-width: 400px){
    .box {
        background-color: red;
    }
}

JSFIDDLE

Solution 2:

There is no closing bracket in your above @media rule -

.box{
    width: 150px;
    height: 150px;
    background-color: blue;
}

@media screen and (max-width: 400px){

    .box{
        background-color: red;
    }

} /* END THIS @MEDIA RULE */

I like to do something really obvious like this to remind me --- You don't need the "and" - or the "screen"

@media (min-width: 30em){ /* ============ */body {
        background-color: red;
    }

} /* === END MEDIUM BREAK =============== */

Post a Comment for "Mediaqueries Max-width Not Working In Firefox"