We are rebuilding. Join us.

We are rebuilding our site—live at building.seesparkbox.com. Join us, real-time, as the site evolves. It will be ugly at times. Sometimes it will be downright broken. But it will always be transparent and real. You can even check under the hood of the public repo on Github and share your ideas. Crazy, are we? Read why we're doing this.

Let’s be more than friends.

We really
like to share

The Foundry is our place to share articles, tutorials, events, and more. Search for a topic or just read everything.

Media Query Bookmarklet

Media Query Bookmarklet

One thing that I quickly noticed when we started building responsive websites was that we were constantly resizing our browsers. We would resize the browser to the largest media query, and then step down and watch the changes so we knew what media query we were looking at. This is not a good way to design a website. I figured that if we had a tool that would show us exactly what size the viewport was, we would know what media queries would be active. Taking it one step further, I thought why shouldn't the tool just tell me which media query just fired?

So, I wrote this little bookmarklet. It parses the included CSS files of the current page and creates an array of media query declarations. It then sets up listeners using the matchMedia method to trigger events when media queries change.

Let Me See It Already

Click the link below to see the media queries on this page, or follow the instructions to add it to your browser and start using it on your own pages.

mediaQuery Bookmarklet

Drag to add to bookmark bar

Check out the source on github.

Browser Support

The page dimensions should work in any modern browser. Media query display is supported in:

  • Chrome 9+
  • Safari 5.1.5
  • iOS 5.1.1

Updates

6/26/12 Version 1.3 Updates

  • No longer displays duplicate media queries
  • "Close" button added to remove element from display
  • Toggle added to move element from right-hand to left-hand of display
Keep up with new posts in the Foundry by subscribing to our weekly email: The Spark.