I have a table that shows tabular data across 7-8 columns, which works very well on a standard monitor.

However, on a smartphone or even a tablet, it's a little less functional.

Is there a way to automatically condense the data into fewer columns when the page is being view mobile devices?

I can detect the user-agent OK, and can use CSS to set off the different data elements.

What I don't know is how to set up the columns differently, I'd really like to set it in 1-2 columns on a mobile device.

Perhaps this belongs in the PHP area, but I'm not sure.

The key is that I'm not using tables for layout, this is tabular data being pulled out of a database.