Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to combine media queries for same CSS rules?

I currently have this chunk of codes.

@media screen and (min-width: 768px) and (max-width: 990px) {
    .community-info-box {
        width: 100%;
        margin-right: 0;
        float: none;
        ... : ...
    }
}

@media screen and (max-width: 630px) {
    .community-info-box {
        width: 100%;
        margin-right: 0;
        float: none;
        ... : ...
    }
}

What I'm trying to do is something like..

@media screen and (min-width: 768px) and (max-width: 990px),
@media screen and (max-width: 630px) {
    .community-info-box {
        width: 100%;
        margin-right: 0;
        float: none;
        ... : ...
    }
}

so I don't have to write the same properties and values again since they are same. Any ideas?
I also searched for "setting more than 2 breakpoints inside a media query" but there's no luck.

like image 926
aniskhan001 Avatar asked Mar 11 '15 15:03

aniskhan001


1 Answers

You don't have to add @media again in the second line. This should work:

@media screen and (min-width: 768px) and (max-width: 990px),
screen and (max-width: 630px) {
    .community-info-box {
        width: 100%;
        margin-right: 0;
        float: none;
        ... : ...
    }
}
like image 111
razemauze Avatar answered Nov 30 '22 17:11

razemauze