KandZ – Tuts

We like to help…!

CSS 30 ๐Ÿ’ป media queries introduction

a - media queries intro and types

Media queries are a fundamental part of responsive web design
They allow you to apply different styles for different screen sizes and device types
They are defined using @media rule in CSS
media types: all โ†’ applies for all devices(default),
print โ†’ styles for print preview mode screen โ†’ styles for screen devices
in media rules you can also use logical operators โ†’ and, not, only and or
@media screen and (min-width: 780px) โ†’ for screen and min width 780px
@media print โ†’ media query for print version


b - media queries common descriptors

width โ†’ Minimum and maximum width of the viewport. height โ†’ Minimum and maximum height of the viewport.
aspect-ratio โ†’ Aspect ratio of the viewport. orientation โ†’ Orientation (portrait or landscape).
device-width, device-height โ†’ Dimensions of the device screen. color โ†’ Number of bits per color component in the output device.
color-index โ†’ Maximum number of colors that can be addressed on the output device. monochrome โ†’ Number of shades of gray in the output device.
resolution โ†’ Minimum and maximum resolution (dots per inch) of the output device.
scan โ†’ Scan type (progressive or interlaced). hover โ†’ Whether hover capabilities are available.
@media (orientation: landscape) โ†’ only for landscape orientation
@media (min-width: 768px) and (max-width: 1024px) โ†’ for width between 768px and 1024px
@media not (hover: hover) โ†’ for non-touch devices


c - media queries best practices

Mobile First โ†’ Start with the smallest screen and build up to larger ones
Avoid Overusing Media Queries โ†’ Too many can slow down your site...
...Aim for a breakpoint every 50-70 pixels or so.
Use Relative Units โ†’ Use relative units like em, rem, % instead of fixed units...
...like pixels to ensure consistency across different devices.
Test Thoroughly โ†’ Test your designs on various devices and screen sizes to ensure they look good everywhere.
Just remember that media queries are a powerful tool in CSS...
for creating responsive web design

Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!

Leave a Reply