How can i have a browser specific css in Drupal 7 . I would like to load chrome.css if browser is chrome . Please help
相关问题
- Drupal 8: How do I customize a form widget to show
- How to balance webserver bandwith usage?
- drupal :: order complete hook and upgrade user per
- Change redirect in Drupal 7 for Password Recovery
- Adding attachment to Jira's api
相关文章
- Render a Drupal node
- How to allow multiple blocks in a module of Drupal
- How can I redirect a Drupal user after they create
- Drupal 6: Getting custom fields into the database
- Drupal 7 retain file upload
- Drupal - Set 'user/%/edit/uprofile' to def
- Drupal Session User id for independent script
- how to construct an https POST request with drupal
I agree with previous speakers, you should absolutely try to change your css so that does not need browser specific code, but if you really need to target the Webkit browsers (Chrome and Safari) you can have a look at this solution:
http://www.evotech.net/blog/2010/04/hack-for-webkit-filter-for-chrome-and-safari/
It is not specific to Drupal, but a so-so accepted way of targeting webkit, in case of emergency.
I recommend using the Conditional Stylesheets module
You can do this in your template.php file with a preprocess_html theme hook and drupal_add_css function.
You will find example in drupal 7 theme, for example in bartik :
Edit : since there are no conditional comments for chrome, you can check $_SERVER['HTTP_USER_AGENT'] :
But before doing this, try to fix your css rules !