...

View Full Version : How to deal with IE



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

mike182uk
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" />
<![endif]-->


then in the main css have this:




#divstyle {
width:17%;
float:right
}



and in the ie css have this




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




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/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum