Skip to content

Instantly share code, notes, and snippets.

@WenLiangTseng
Created August 23, 2013 10:18
Show Gist options
  • Save WenLiangTseng/6317763 to your computer and use it in GitHub Desktop.
Save WenLiangTseng/6317763 to your computer and use it in GitHub Desktop.
依據不同的瀏覽器,來給予不同的CSS或JS(browser conditional css/js)
<?php
if(isset($_SERVER['HTTP_USER_AGENT'])){
$agent = $_SERVER['HTTP_USER_AGENT'];
}
if (strlen(strstr($agent,"Chrome")) > 0) {
echo '<style type="text/css">#element{top:1px;}</style>';
}
// 'firefox', etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment