Css conditional instruction for firefox

I have problems with css in firefox, so I want to import the css file only if the browser is FF

Actually, I need to import these styles:

.searchbutton{ position:absolute; right:3px; width:25px; top:3px; } #buscarmain{ bottom:12px; } 

EDIT:

Many argue that I should not use a special operator for FF, since FF is likely to be correct compared to other browsers.

However, in this case, all browsers print the same page (IE, Chrome, Opera, Safari), and FF displays it in a different way. I have to achieve the same visualization for all browsers, so I need a special FF instruction

+7
source share
5 answers

solved a problem

just added:

  <script type="text/javascript"> if ( $.browser.mozilla == true ) { document.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"FF.css\">"); } </script> 
+8
source
+12
source

Here's how we can customize CSS styles only for Firefox:

 <style type="text/css"> @-moz-document url-prefix() { h1 { color: red; } } </style> 

Source: Firefox targeting with CSS only

+12
source
+4
source

IE is the only browser with conditional comments. I always felt that each browser should have its own, but alas.

I think the solution is to tweak your stylesheet so that it displays correctly in Firefox and then fixed for IE.

A crude and very dirty solution would be to use JavaScript to detect the browser and add a class, such as ffonly, to the body tag, if the browser is Firefox. Then always bring your Firefox style sheet, but put β€œ.ffonly” at the beginning of all style rules.

+1
source

All Articles