I am trying to set up several media queries to set the width of a wrapper div.
I'm finding that the media query is not honoured.
Here is an example of 4 breakpoints with different widths for the outlined div.
If I narrow the screen to 1000px wide, the media query rule states that the div should be 960px
wide yet I find it honours instead the largest media query and sets the width to 1388px.
https://codepen.io/asos-francesca/pen/ZEGXjyG
@media only screen and (max-width: 1024px) {
.wrapper {
width: 960px;
}
}
@media only screen and (max-width: 1280px) {
.wrapper {
width: 1140px;
}
}
@media only screen and (max-width: 1400px) {
.wrapper {
width: 1300px;
}
}
@media only screen and (min-width: 1440px) {
.wrapper {
width: 1388px;
}
}
Am I misunderstanding how media queries should work?