问题
Is it possible to detect Firefox Browser only with CSS like IE?
for example, IE browser can be detected like:
<!--[if IE 7]>
/* IMPORTING CSS FOR IE */
<![endif]-->
Can be Firefox browser detected like this code?
回答1:
Not that I know of, but you can try this:
@-moz-document url-prefix() {
#my-id { font-size: 100%; }
}
This website has more options as well
You can place this in your CSS file or between your <style type='text/css'>
tags in your HTML. Works Fine!
回答2:
Nowadays you can use the @supports CSS rule:
@supports not( -moz-appearance:none ){
/* Add non-firefox CSS code here */
}
来源:https://stackoverflow.com/questions/5874122/is-it-possible-to-detect-firefox-users-in-pure-css