1

My common css rule is like:

#dayslist > div {
   height: 51px;
}

and media Query css rule:

@media (max-width: 979px){
    #dayslist > div {
        height: 44px;
    }
}

But when I shrink my browser to width less than 979px the media query rule does'nt apply and common css rule takes precedence over the rule defined in media query.

enter image description here

i alarmed alien
  • 9,232
  • 3
  • 26
  • 40
bhavya_w
  • 7,962
  • 8
  • 26
  • 37

1 Answers1

2

You're overwriting your media query declarations with a later statement:

@media (max-width: 979px){
    #dayslist > div {
        height: 44px;
    }
}

...

#dayslist > div {
   height: 51px;
}

Regardless of the screen width, the second statement, setting the height to 51px, will always apply. The solution is to load the media queries after the general declarations, so that they override the general css rules, i.e.:

#dayslist > div {
   height: 51px;
}
@media (max-width: 979px){
    #dayslist > div {
        height: 44px;
    }
}
i alarmed alien
  • 9,232
  • 3
  • 26
  • 40