I tried to follow the recommendation to try to avoid media queries whenever possible
So, here is my solution: https://codepen.io/bor770/project/editor/ARLOdY
I was very proud of myself for limiting the scope of the media query to the nav only, and having the main layout work correctly for both the narrow and the wide screen, using a flexbox for main.
Then I saw your solution:
Here, you used a single media query, to rewrite the whole site.
So, on the one hand, your media query has a much wider scope than mine, but on the other hand, you had to write much less lines of CSS than me.
In general, what is the better approach? Should I try to minimize the size of the code, or the scope of the media queries?
reduce the size of code is good to reduce the amount of the bandwidth needed especially for large project but also the readability and clearity of the code is important
Thank you for your response!
I still don’t understand, why is it recommended to try to avoid using media queries if possible? What’s the advantage of having a flexbox, for example, instead of a media query?
So, if you had to choose between having a few line of CSS using a media query, or twice as much lines avoiding the media query, giving the same layout, which would you choose?
first i want to clear one thing that i am student like you
for me i would use flex or grid
after you finish this course you will use already made component which would help you and will make your page responsive but of course learning it is good thing in case if you want to edit something or build custom component