Selecting CSS according to User Browser

This sections will contains code regarding different PHP & MySQL features and contains help about php/mysql issues.

Selecting CSS according to User Browser

Postby Shahzad Butt on July 24th, 2008, 4:36 am

In order to use multiple css files, one per specific browser, simply use the below code to select a specific css file according to the current browser.

Code: Select all
<?
if ($name = strstr ($HTTP_USER_AGENT, "MSIE"))
{
?>
<link rel="stylesheet" href="internet-explorer-stylesheet.css">
<?
}
else if ($name = strstr ($HTTP_USER_AGENT, "Netscape"))
{
?>
<link rel="stylesheet" href="netscape-stylesheet.css">
<?
}
else
{
?>
<link rel="stylesheet" href="other-stylesheet.css">
<?
}
?>
Regards
Shahzad Butt
http://www.GeoSourceCode.com
Shahzad Butt
 
Posts: 19
Joined: July 9th, 2008, 11:16 am
Location: Pakistan

Return to PHP / MySQL / XML

Who is online

Users browsing this forum: No registered users and 0 guests