What are media queries in CSS, and how do they enable responsive design?
108
28-Oct-2024
Updated on 28-Oct-2024
Ashutosh Kumar Verma
28-Oct-2024Media queries allow you to apply CSS styles based on specific conditions, such as screen size, orientation, or device type. They're essential for responsive design, which allows web pages to adapt their layout and style to different devices and screen resolutions.
The most common media queries use the min-width and max-width properties to target different screen sizes. For example, you can create a mobile-friendly design by applying a style only when the screen width is less than a certain value.
Example-
Also, Read: What is the difference between margin and padding