Great technique using PHP to detect the user agent of a visitor’s web browser, and then doing some regex magic to generate a filename. Here’s what you use in your HTML:
<link rel='stylesheet' type='text/css' href='<?php include 'inc_css.php' ?>'/>
The included PHP script will then return for example “w3c.css” to Firefox and “ie.css” to Internet Explorer. Yes, it’s duplication of effort maintaining two (or more) CSS files. But–no hacks to worry about now or down the road when browsers change. Plus he made the point that I’ve been thinking about a lot lately:
“You can create a specific style sheet for small screen readers such as PDA’s or web enabled phones.”
[TIP: Browse to Google from Pocket IE, you might be surprised that its a different page. Do they sniff the user agents? They don't use CSS, I checked.]

No comments yet.