You want your code to be responsive to the width of the user's screen
(or, preferably, browser window). There's a problem in that PHP runs on
the server and doesn't normally have access to that information.
I use this and have Javascript set a cookie with the window width (and
height). This can be retrieved and used in PHP. There's still a problem
in that the cookie won't be available until the next page load, but that
can be triggered in JS.
Modern browsers also have a CSS setting for columns, which you might be
able to use.
--
Mark Lloyd
http://notstupid.us/
"The deepest sin against the human mind is to believe things without
evidence." -- Thomas Henry Huxley (1825-1895)