View Full Version : How to deal with IE

11-13-2009, 03:36 PM
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">
<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?


11-13-2009, 03:51 PM
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:

<link rel="stylesheet" type="text/css" href="main.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie-only.css" />

then in the main css have this:

#divstyle {

and in the ie css have this

#divstyle {

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

<div id="divstyle "></div>

for more info on this check out this page: http://css-tricks.com/how-to-create-an-ie-only-stylesheet/