WordPress Code Snippets

A fresh mix of code snippets and tutorials

CSS Multiple Media Queries


@media queries are instrumental in creating responsive CSS designs. This tutorial explains how to combine multiple media queries to keep things optimized.

Let’s say that you have the following media queries:

Such that, say, the default body background color is red, but you want it to be blue for these specific media queries. Given this scenario, we can optimize file size by combining these media queries like so:

The key here is to use a comma , between multiple @media selectors. That enables you to combine as many media queries as desired. This may not seem like a big deal for a simple one-property example, but when each query contains numerous overlapping properties, the savings can be significant.

Show Support

Like our new Facebook Page to show support!