You can search the useragent, and check the browser, and based on that, you can then set your css.
Follow the example:
if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$css = "border: solid 5px blue;";
$browser = 'IE';
} elseif (preg_match( '|Opera/([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$css = "border: solid 5px blue;";
$browser = 'Opera';
} elseif(preg_match('|Firefox/([0-9\.]+)|',$useragent,$matched)) {
$css = "border: solid 5px red;";
$browser = 'Firefox';
} elseif(preg_match('|Chrome/([0-9\.]+)|',$useragent,$matched)) {
$css = "border: solid 5px blue;";
$browser = 'Chrome';
} elseif(preg_match('|Safari/([0-9\.]+)|',$useragent,$matched)) {
$css = "border: solid 5px red;";
$browser = 'Safari';
} else {
$css = "border: solid 5px red;";
$browser= 'other';
}
Use as follows:
In the $css
i include the CSS, and then you can put:
<style>
section#internal.services aside ul li a {
<?php echo $css; ?>
}
</style>
With this, you will import css correctly.
The html page is generated from a template engine like dwoo or Smarty?
– Ricardo
@Ricardo No...
– Skyirn
How is it generated? post here
– Ricardo
@Sorry, I’m new to programming, I don’t understand what you mean...
– Skyirn
I posted for you the answer, check. I tested here and it’s working correctly.
– Sr. André Baill
I edited my answer as I did not have your two Css links to give the same effect.
– Ricardo