Memo on CSS3 media queries
Image by Clovis Cheminot from Pixabay
Reminder: you can left-scroll and right-scroll the long code blocks.
Intro
Media queries allow the HTML UI to adapt to the user’s device. This post focuses on a short
reminder of common media queries used on responsive designs (2022).
See a more detailed presentation here.
Media query syntax
1 | @media [not|only] mediatype and (condition: breakpoint) { |
Examples:
1 | @media print { |
Reference breakpoints
We can take inspiration from the famous Boostrap library.
Name | Short name | Min width | Max width (excluded) |
---|---|---|---|
Extra small | xs | 0 | 576px |
Small | sm | 576px | 768px |
Medium | md | 768px | 992px |
Large | lg | 992px | 1200px |
Extra large | xl | 1200px | 1400px |
Extra extra large | xxl | 1400px | ∞ |
Reference media queries
1 | /* ****************** xs : extra small ****************** */ |
That’s all for this memo. Leave a comment ✍️ and a “Like” ❤️ if you found this post useful 😉
Thanks for reading !
See you soon !
Keep learning !
Written on Fri Dec 23rd 2022, 5:54 GMT+00:00.
Last updated on Fri Dec 23rd 2022, 10:54 GMT+00:00.