Compatibility IE/Firefox with one CSS File

Discussion in 'CSS' started by Al-k-pone, Nov 15, 2006.

  1. #1
    Most sites makes 2 CSS files, one for IE, other for Firefox.
    That's true, they display html different.

    So webmasters must found the browser and include the right CSS.

    A tiny tips is to insert !important for CSS declaration destiny to Firefox.
    For the same declaration, in this example : color, you must declare for firefox before.
    .class{
             font-family: arial;
             font-size:11px;
             color:#FF0000 !important; /* Only for Firefox */
             color:#000000; /* Only for IE */
             font-weight:normal;
    }
    Code (markup):
    Happy to help you.
     
    Al-k-pone, Nov 15, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    You are starting from a faulty premise. Very few professional web developers would use browser specific style sheets. To do so is to admit a lack of understanding of just how the various browsers support css.

    Even IE5, if you still refuse to treat it as the corpse it is, requires only a different approach to sizing; not hacks, but work-arounds. The various hasLayout related bugs in IE5&6 can be dealt with without using browser specific rules. There are occasional times when a browser specific rule might be needed, but a little study will usually reveal a better approach.

    IE7 will likely be the pig in lipstick until we learn its quirks. It is said to have fixed most (all?) the faulty float model bugs, but it still has hasLayout, which ranks among the top ten stupidest things they've done. By making IE7 slightly better, without actually making it good, MSFT may have forced separate stylesheets for IE hacks. And, that's a Bad Thing®.

    cheers,

    gary
     
    kk5st, Nov 16, 2006 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sometimes though, a separate stylesheet is required. Specifically if you use expressions and filters. Keep in mind though that these are typically used by people who are trying to fix certain problems in IE (like min/max-width/height, :hover and :focus support, etc) but do not have a lot of actual (or in some cases any) JavaScript/JScript coding experience.
     
    Dan Schulz, Nov 16, 2006 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    Dan,

    I see your point, and remind you of my first paragraph.

    The use of filters and expressions need not be removed to a separate stylesheet. Modern browsers will simply ignore the invalid rules/selectors/values. Keeping them with the context in which they belong makes edits and debugging that much simpler and less prone to error. If you're worried about validity, having the invalid rules in a separate file or even hidden by a conditional comment tag does not make them any less invalid.

    cheers,

    gary
     
    kk5st, Nov 27, 2006 IP
  5. AdamSee

    AdamSee Well-Known Member

    Messages:
    422
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    135
    #5
    IE7 is a bit of a bitch to work with at the moment. They've fixed a lot, but there are other quirks that are harder to target and cause a right pain in the arse. It's definitely two steps forward and one step back.
     
    AdamSee, Nov 27, 2006 IP