An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
The complete guide to CSS media queries
Did you know there is a media query for inverted colors? Or one for saving data?
Media queries are what make modern responsive design possible.
With them you can set different styling based on things like a users screen size, device capabilities or user preferences.
But how do they work, which ones are there and which ones should you use?
I set out to write the ultimate guide to media queries, going over every little detail, like which media types there are, all the media queries you should use now, you will use in the future and the ones you should no longer use.
Here's the complete guide to CSS media queries
It's as much a reference as an opinionated description of how to best use them. It also has many clever tips, like this cheap dark mode that will get you a good looking site in just a few lines of code:
@media (prefers-color-scheme: dark) { :root { background: #111; filter: invert(1) hue-rotate(180deg); } img, video { filter: invert(1) hue-rotate(180deg); }}
If you wanna understand how it works, head on over to the complete guide to CSS media queries
Original Link: https://dev.to/polypane/the-complete-guide-to-css-media-queries-15d2
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To