Design comparison
Solution retrospective
please rate it...
when I change the text sizes in media queries the original sizes override the changes I used the " !important" flag to force the changes to happen please can anyone explain why the original sizes override the new ones in media queries?
Community feedback
- @oussamaelomriPosted almost 2 years ago
Ok, I will tell you what is the problem. The problem is "cascade": the order of CSS rules matter (the order of selectors is very important). Cascade and inheritance read this article specially the part of Cascade, it will help you a lot. You write firstly in your CSS stylesheet @media (max-width: 767px){} (you target mobiles), and after it, you target desktops. to solve this problem reverse the CSS code, first target the desktop, and after it target mobile, and you will avoid the !important flag
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord