Responsive Tables

Why We Built This

When we looked around at the various implementations of responsive tables on the web, we saw lots of interesting ideas but nothing we thought was a really great implementation. Chris Coyier on css-tricks.net did a great round up of responsive data tables and while there's some fascinating ideas in there, nothing seemed to meet the criteria we had for a great implementation:

Doesn't break responsive layouts

Doesn't unnecessarily hide data

Still lets you compare rows

With those existing tricks in mind, we set out to develop this, a CSS/JS combo that takes existing tables and modifies them for small devices so they meet our criteria. It works by taking the first column and "pinning" it to the left of the table, allowing you to scroll the other columns under it. You don't lose the likely key for each row, but you also don't have to break your nice responsive layout.

We built these specifically to work with Foundation, our open source front-end framework for responsive sites, but it would work just fine with any responsive site.

How to Make Your Tables Responsive

We wanted this to be incredibly easy to implement. Start by downloading the code pack — this includes a demo file as well as the two key files you need for this: responsive-tables.js and responsive-tables.css.

Attach to Your Markup

On any data table in your markup, you simply need to attach a class of .responsive and the CSS/JS will do the rest. Like so:

<tableclass="responsive"><tr> …

Ready to Rock

From there on your tables will be modified client-side when the window is smaller than a regular tablet (so most any smartphone or very small tablets).

Device Compatibility

This technique was tested on iOS, Android and Windows Phone 7 (as well as Chrome, Safari and Firefox). One caveat is that because Android 2.3 doesn't support scrollable divs on the page, the scrolling won't work on those devices. Android 3 and up does support this, so it's not an issue on newer Android phones.

Check out other Playground experiments

Get started with finishing

Team up with our designers to see how our iterative design process can get your project going. Equipped with our Progressive Design process, visual skills, and the coding chops that brought you Foundation, ZURB Studios is ready to jump in and get your product out to the masses!