Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

conditional css statement for firefox

I'm having problems with css in firefox, therefore I want to import a css file only if the browser is FF

Actually, I need to import this styles:

.searchbutton{
    position:absolute; right:3px;  width:25px;  
    top:3px;
}

#buscarmain{ bottom:12px;

}

EDIT:

Many have argued that I shouldn't use a special statement for FF, since FF is most probably 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 another way. I must achieve the same visualization for all browsers, therefore I need a special FF statement

like image 397
Dan Stern Avatar asked Jan 01 '11 20:01

Dan Stern


3 Answers

Here is how we can target CSS styles only for Firefox:

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

Source: Targeting only Firefox with CSS

like image 146
J. Bruni Avatar answered Sep 20 '22 04:09

J. Bruni


You might try the css browser selector

like image 31
Xuni Avatar answered Sep 18 '22 04:09

Xuni


solved the problem

just added:

    <script type="text/javascript">
    if ( $.browser.mozilla == true ) {
      document.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"FF.css\">");
    }
</script>
like image 20
Dan Stern Avatar answered Sep 18 '22 04:09

Dan Stern