View Full Version : CSS depending on browser
Forge
05-01-2008, 12:51 PM
Hey just to let you guys know. Ive found this tutorial.
I thought it might be useful to you guys ;)
http://boon-tech.com/tutorials.php?id=php&tut=browser_dependent
Moved by Agesilaus (Forum Moderator) from Designing and Development: Please post in the correct forum next time. :)
DeejayMachoo$
05-01-2008, 02:38 PM
Hey just to let you guys know. Ive found this tutorial.
I thought it might be useful to you guys ;)
http://boon-tech.com/tutorials.php?id=php&tut=browser_dependent
odea
<?
if ($name = strstr ($HTTP_USER_AGENT, "MSIE"))
{
?>
<link rel="stylesheet" href="ie_stylesheet.css">
<?
}
else if ($name = strstr ($HTTP_USER_AGENT, "Netscape"))
{
?>
<link rel="stylesheet" href="netscape_stylesheet.css">
<?
}
else
{
?>
<link rel="stylesheet" href="others.css">
<?
}
?>
<?
if ($name = strstr ($HTTP_USER_AGENT, "MSIE")) {
echo("<link rel=\"stylesheet\" href=\"ie_stylesheet.css\">");}
elseif ($name = strstr ($HTTP_USER_AGENT, "Netscape")) {
echo("<link rel=\"stylesheet\" href=\"netscape_stylesheet.css\">");
} else {
echo("<link rel=\"stylesheet\" href=\"others.css\">");
}
?>
MrCraig
05-01-2008, 02:38 PM
Nice find :)
But i think most people already know how to do it..
DeejayMachoo$
05-01-2008, 02:39 PM
Nice find :)
But i think most people already know how to do it..
yeh and also if your gona be xhtml and valid css then you dont need this :)
And for the older versions of IE, I think if you view Habbo's Source code its there :P
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="style.css" />
<![endif]-->
conditional comments. Much easier?
php.net
05-01-2008, 04:08 PM
Why all the PHP code if you could do a simple <!--[if IE]> <![endif]-->?
craigg.
05-01-2008, 05:31 PM
I agree wit above two statements, however it may be useful for people who are using unusual browsers which are worse than IE (I dont think it's possible, but it could be).
It may be of help to some other users, +rep if possible.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.