what are the hacks used only for IE7,Opera,Safari

Discussion in 'CSS' started by majorkarthik, Sep 3, 2007.

  1. #1
    We are using the following hacks which is specific for particular browsers

    * hmtl .classname{} -- for IE6
    div[id$="selSubHeader"]:not([class="XXX"]){} -- for FF

    I want to know the hacks for IE7,Opera,Safari.

    I will be more gratitude if any one helps me.
     
    majorkarthik, Sep 3, 2007 IP
  2. GWiz

    GWiz Peon

    Messages:
    359
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First things first, why in the world would you need separate style sheets for practically every browser?

    The only time you would ever want a separate style sheet is only for IE6 and sometimes IE7. And that is the ONLY time. Firefox, Opera, and Safari pretty much render things correctly 99.9% of the time.

    In the event you want to use a separate css for IE6 or IE7 you can refer to the following website for help:
    http://www.quirksmode.org/css/condcom.html

    If it just so happens that your having coding problems that require you to have specific code for each browser, than I would recommend you link us to your website, or post your code that way we can take a look and help you. More times than not, poor HTML/CSS can be the cause of your problems rather than browser issues.
     
    GWiz, Sep 3, 2007 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    I would NEVER use the conditionals gwiz suggested, preferring inline hacks like the "* html" you mentioned for IE6 because running multiple stylesheets for one media type is just overcomplicating matters (and wasting an extra request/http session)

    IE7 sometimes still needs a slap upside the head, but the only thing that really seems to be on is form elements - which the 'preferred' way of targeting IE7 is:

    *:first-child+html .classname {}

    as listed on:

    http://www.webdevout.net/css-hacks

    For Opera and Safari though GWiz was right on the money - there is rarely if ever a reason to hack for them (and usually it's simpler to hack for FF in that case because it's not obeying the standards while op/saf are)... at least assuming you aren't tying yourself to nonsense which is FF only (which is as flawed a philosophy as coding for IE only - which is why you TEST IN ALL BROWSERS AS YOU GO)

    The only time I ever had to hack for FF was because it required top:0 on a absolute element inside a inline-block pos:relative one, Opera and safari defaulting properly but screwing up when top:0 was included.

    In that case, I used the rarely seen

    html:not([lang*=""]) .classname {}

    a good reference for older methods is available at:

    http://centricle.com/ref/css/filters/
     
    deathshadow, Sep 4, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm going to have to agree with deathshadow on this one. If you need to use hacks for IE 7, Opera and Safari, you're probably doing something wrong. In which case it would be better to ask for help (depending on which forum you go to, either deathshadow or myself - or someone who knows as much about CSS and browser quirks as we do - will be more than happy to help you out).
     
    Dan Schulz, Sep 5, 2007 IP