Link to home
Create AccountLog in
Avatar of go4java
go4java

asked on

Special CSS for MSIE / FF?

How exactly can I define CSS differences between the most common browsers MSIE (6) and FF (2)?
I'd like to include special CSS for each of them and the CSS class should automatically been considered.

Currently I've a construction like that:

<link href="css/itsi.css" rel="stylesheet" type="text/css" />
<!--[if gt IE 5]>
  <link type='text/css' rel='stylesheet' href='css/msie.css'>
<![endif]-->

<style type="text/css">
    <!--                        
    -->
</style>


...but how can I differentiate when I'm addressing a certain CSS class?!?
Avatar of Mark Steggles
Mark Steggles
Flag of United States of America image

Hello,

You would simply put your style class in each of your css files (itsi.css + msie.css) with your desired values. If you wanted it in the head of the page, it would look like this:

<style type="text/css">
.yourClass {styles}
</style>

<!--[if lte IE 6]>
<style type="text/css">
.yourClass {styles}
</style>
<![endif]-->


As for coding specifically for ff2, I have never had to do this, why do you need to do this?

Steggs
Avatar of go4java
go4java

ASKER

If I place:


    .col_flag_end_date {
            position:absolute;
            left:100px;
            top:500px;
          }

<!--[if gt IE 5]>
    .col_flag_end_date {
            position:relative;
            left:100px;
            top:20px;
          }
<![endif]-->


...in an 'include': <link href="css/special.css" rel="stylesheet" type="text/css" />

Does it work like that: ???

Always use

    .col_flag_end_date {
            position:absolute;
            left:100px;
            top:500px;
          }

except for MSIE > 5 ???
ASKER CERTIFIED SOLUTION
Avatar of Mark Steggles
Mark Steggles
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of go4java

ASKER

If I'm using:

<link href="css/special.css" rel="stylesheet" type="text/css" />

<style type="text/css">  
<!--[if gt IE 5]>
    .col_flag_end_date {
            position:relative;
            left:100px;
            top:20px;
          }
<![endif]-->
</style>

FF works as expected (takes the CSS class from special.css, but MSIE does not show any result?!?
Probably because you need the style inside the conditional comment

<!--[if gt IE 5]>
<style type="text/css">  
    .col_flag_end_date {
            position:relative;
            left:100px;
            top:20px;
          }
</style>
<![endif]-->
Hey man,

Thanks for points but why only a B grade? Was the answer not sufficient?

Steggs