Github Project - Version 2.5.0
Created & Maintained by Gary Hepting

Media Queries

Restrict CSS rules to targeted browser conditions, such as viewport widths & pixel densities

Documentation: Media Queries


Example Media Queries

Mobile

@media (max-width: 480px) {
  // CSS that only applies to viewports 
  // less than or equal to 480 pixles goes here
}

Not Mobile

@media (min-width: 481px) {
  // CSS that only applies to viewports 
  // greater than 480 pixles goes here
}

Small Tablet

@media (max-width: 767px) {
  // CSS that only applies to viewports 
  // less than 768 pixles goes here
}

iPad

@media (min-width: 768px) and (max-width:1024px) {
  // CSS that only applies to viewports 
  // of similar size to the ipad goes here
}

Desktop

@media (min-width: 1025px) {
  // CSS that only applies to viewports 
  // greater than 1024 pixles goes here
}

iPad Retina

@media (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
  // CSS that only applies to viewports 
  // of similar size to the ipad and 
  // with double pixel density goes here
}



Targeted Breakpoints

Groundwork utilizes Sass variables to introduce logical media queries which can help keep code organized, meaningful, and easier to read. The Sass variable names make targeting common devices and viewport size ranges a more intuitive and more natural step in the optimization process.