What are media queries in CSS?

A media query applies CSS only when a condition is true, such as a maximum or minimum screen width. They make a page responsive.

@media (max-width: 600px) {
  .sidebar { display: none; }
  .column { width: 100%; }
}

You can also test orientation, print mode and dark mode. See CSS Media Queries.


Learn more about the similar topics:
Tutorials
CSS Media Queries
Exercises & Assignments
Write CSS to make an image responsive and round
Interview Questions & Answers
What are media queries in CSS?
What is the mobile first approach in CSS?