Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to deal with IE

    HI
    I have a site and I already have many problems with IE.I want to say in my code that if the user use IE execute a sertain divv and if not another one for example:
    <!--[if IE]>
    <div style="width:200px;float:right">
    <![endif]-->
    <div style="width:17%;float:right">

    But as you can see IF the user's browser was IE it make two div but What I want to do is that if the user use ie just the specify IE code run and the second one not.So I want something like 'else'.
    How can do so?

    thanks

  • #2
    Regular Coder
    Join Date
    May 2008
    Posts
    135
    Thanks
    13
    Thanked 10 Times in 10 Posts
    unfortunately that wont work. that statement only works for ie browsers and you wouldnt put that type of code in the body of the document. a better way of doing it is having 2 differenet style sheets. one for all browsers and one for ie (if you really cant get the css to work accross all browsers)

    so in the haed of your document:

    Code:
    <link rel="stylesheet" type="text/css" href="main.css" />
    <!--[if IE]>
    	<link rel="stylesheet" type="text/css" href="ie-only.css" />
    <![endif]-->
    then in the main css have this:

    Code:
    #divstyle {
        width:17%;
        float:right
    }
    and in the ie css have this

    Code:
    #divstyle {
        width:200px;
        float:right
    }

    and of course in your page give the div the id (or class)

    Code:
        <div id="divstyle "></div>
    for more info on this check out this page: http://css-tricks.com/how-to-create-...ly-stylesheet/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •