1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

CSS if statement

Discussion in 'CSS' started by dean5000v, Mar 25, 2008.

  1. #1
    i was wondering if you can do a CSS if statement so it its IE do this else FF do this. only if statements i've seen are for the older version on IE
     
    dean5000v, Mar 25, 2008 IP
  2. LoCo

    LoCo Well-Known Member

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #2
    no, sometimes it might be a pain in the ass to have your css work with both IE and FF, but if you know how that can be fixed pretty fast, and instead of that if statement you can use javascript to detected browser and then you can lets say have 2 sepearate css files one for each browser, detect it with javascript and then use css according to browser

    i thought about doing it that way many times, but so far i was able to make my css work with all browser

    maybe this helps?!

    regards
     
    LoCo, Mar 25, 2008 IP
  3. paul_delaney

    paul_delaney Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use an IF statement using ASP, you have to use the <%
    user_agent = request.servervariables("HTTP_USER_AGENT")
    response.write("The browser you are using is: " & user_agent)
    %> to get the browser, so your if statement will look for IE and you can then load the correct CSS file
     
    paul_delaney, Mar 25, 2008 IP
  4. deques

    deques Peon

    Messages:
    206
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    put this code somewhere in the html file
    <!--[if lte IE 6]>
    ..css code
    <![endif]-->

    if the browser is IE6 or lower, the page will load everything within the if statement
     
    deques, Mar 25, 2008 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ^ you can also do [if IE], [if lte IE7], [if gt IE6]... it's pretty flexible but are only for IE. As far as I know, except with CSS hacking, you can't say if Opera do this and if FF do that.
     
    Stomme poes, Mar 26, 2008 IP