When I try to apply media queries for max-width 768px
and max-width 425px
, I noticed that the styles intended for max-width 768px
are also being applied when the width is 425px. This results in the
al-articles-tags-chip-list-container
having a width of 600px on a device with a width of 425px, which is unexpected.
However, the media queries work as expected for width 768px
.
.al-articles-tags-chip-list {
width: 100%;
}
.al-text-before-search {
font-size: 36px;
margin-right: 22px;
}
.al-search-input-container {
flex: 2;
}
.al-articles-tags-chip-list-container {
margin: 0 auto;
padding-top: 150px;
width: 1000px;
display: flex;
}
@media only screen and (max-width: 1024px) {
.al-articles-tags-chip-list-container {
width: 700px;
}
}
@media only screen and (max-width: 768px) {
.al-articles-tags-chip-list-container {
width: 600px;
}
.al-text-before-search {
font-size: 26px;
}
}
@media only screen and (max-width: 425px) {
.al-articles-tags-chip-list-container {
display: block;
width: 300px;
padding-top: 115px;
}
.al-text-before-search {
font-size: 26px;
}
.al-search-input-container {
flex: unset;
}
}
<div class="al-articles-tags-chip-list-container">
<div class="al-text-before-search">
<span>I WOULD LIKE TO SEE</span>
</div>
<div class="al-search-input-container">
<mat-form-field class="al-articles-tags-chip-list">
....
</mat-form-field>
</div>
</div>