Detect browser and make CSS for each one

Hello, I’m developing a site with a friend, and we’ve used CSS3 to the graphics, for optimizing the site most. But there are some bugs when viewing the site in etc opera, IE and FF - small charges we know how to solve if we use browser specific CSS - We know how to target IE, but what about other browsers.

We’re using PHP, and found this great site: http://chrisschuld.com/, a PHP-script to detect the browsers, then we want to make a switch that include a CSS for each different browser… (We know this will require alot of coding of CSS with many files) but we know that if we use a switch, we can make it render etc. “Chrome-only”-css, We’ve fixed every error on the page, even made graphics for the site to IE, for rounded borders, and so, so it looks great. But we need to find a way to make that switch using the link above, or another way to detect the browser.

Any that have an idea how we can do this?

Regards,
Lucas

Use Modernizr. It adds classes to the <html> element describing what the browser is capable of.

For example, it will add “multiplebgs” or “no-multiplebgs” depending on whether the browser supports multiple backgrounds. Then, in your CSS, you can target those classes, thus feeding them different CSS rules.

Feature detection is better than browser detection.

Thank you for answer, but I’m more looking for specific browser CSS, because etc. FF have a little problem with links and uppercase, it adds a little margin right to the link, and it’s stuff like that I want to fix, without any need of javascript, and I know you can do it in PHP, but it’s more about how.

If coded correctly you really shouldn’t need to target independent browsers but if you want. In the top paragraph of this tut I link to 3 other tuts to target other browsers. http://www.visibilityinherit.com/code/target-ie.php

The link to shelfimage post seems to be dead. Here is the direct link http://www.killersites.com/community/index.php?/topic/2562-php-to-detect-browser-and-operating-system/

There’s no way to tell what browser is being used. What information is available is only useful for statistical purposes as it isn’t always correct (since the only place the browser is identified is a user enterable field).

If the browser identifies itself as “Eat at Joe’s” would you treat that as Internet Explorer or as Firefox (it is possible to set both of those browsers up to identify themselves as that).