Introduction

Media queries are the backbone of the Responsive Web Design system.
By using media queries we can customize the behavior of DOM elements on the screen for particular devices or screen sizes without changing the actual markup. Media queries use certain breakpoints in the CSS file to change the styling of the HTML elements.

What exactly is a Media Query?

Media query is a CSS technique introduced in CSS3. It uses the @media rule to include a block of CSS properties only if a certain condition is true. Media queries can be used to check many things, such as:

  • width and height of the device
  • orientation (is the tablet/phone in landscape or portrait mode?)
  • resolution

A Simple Example

In Conclusion

Media queries allow designers to build experiences for a wider range of devices than ever before. More importantly, they allow you to fine-tune your designs for an increasingly mobile audience. I hope this small intro into the world of media queries has been helpful. Feel free to reach out to on LinkedIn and happy coding!