Because there is a later style that will override it and it's the one in the last media query:
@media screen and (max-width: 1199px) {
h1 {
font-size: 2rem;
}
}
So if we only consider the styles of your h1
we have this CSS:
h1 {
color: #2d3c49;
text-transform: uppercase;
}
h1 {
font-weight: 200;
font-size: 2.6em;
margin-bottom: 0;
}
@media screen and (max-width: 767px) {
h1 {
font-size: 1.6em;
}
}
@media screen and (max-width: 991px) {
h1 {
font-size: 1.7rem;
}
}
/* This one will always win the race !*/
@media screen and (max-width: 1199px) {
h1 {
font-size: 2rem;
}
}
<h1>Natalie Cardot</h1>
So when you screen is lower than 767px
it's also lower than 1199px
that's why your style defined within the first media query is not considered and you are obliged to use !important
. To avoid this you need to re-order your media query like this:
h1 {
color: #2d3c49;
text-transform: uppercase;
}
h1 {
font-weight: 200;
font-size: 2.6em;
margin-bottom: 0;
}
@media screen and (max-width: 1199px) {
h1 {
font-size: 2rem;
}
}
@media screen and (max-width: 991px) {
h1 {
font-size: 1.7rem;
}
}
@media screen and (max-width: 767px) {
h1 {
font-size: 1.6em;
}
}
<h1>Natalie Cardot</h1>