Understanding media queries
The developer Bruce Lee sums it up perfectly, when likening the effects of media queries to how water acts in different containers:
Empty your mind, be formless, shapeless—like water. Now you put water in a cup, it becomes the cup; you put water into a bottle it becomes the bottle; you put it in a teapot it becomes the teapot. Now water can flow or it can crash. Be water, my friend.
We can use media queries to apply different CSS styles, based on available screen estate or specific device characteristics. These might include, but not be limited to the type of display, screen resolution, or display density. Media queries work on the basis of testing to see if certain conditions are true, using this format:
@media [not|only] ...