tags:

views:

190

answers:

3

Hi,

I am working on a project, in which I am particularly using the CSS with themes. I am facing a compatibility problem between IE7 and IE8. I have placed a ASP.Net menu on page in <div>. Applying CSS style on the div as follows.

.TopMenuPanel
{
background-color:#3783a9;
position:relative;
left:597px;
top:0px;
width:573px;
height:24px;
text-align:left center;
}

When I am seeing the page on IE7, the menu showing in one position whereas in IE8 it is showing in another position. Specific talking, in IE7, on the position of Left:597px Top:0px it is showing in before the half page, and in IE8 it is showing after the half page.

Anybody else have any experience of such a problem, then please give me the expert solution on this problem.

A: 

If you know that your code works in IE7 you can force IE8 browsers to use IE7 standards by including the following tag inside

<meta http-equiv="X-UA-Compatible" content="IE=7">

IE 8 will behave exactly like IE7

Kasturi
Thanks, it works but will it be worked on fireFox and safari as well.
Kamlesh
I have checked on fireFox, but it gives me the same problem as I am facing the compatibility issue in between IE7 and IE8.
Kamlesh
you've gotta treat firefox and IE as separate entities. I think you would most probably be ending with two different styling rules.. one for IE... the other for the rest..
Kasturi
A: 

Make sure you have the standard DOCTYPE at the top of the document. IE7 will run in quirks mode without the DOCTYPE, but IE8 will run in standards mode regardless by default.

Try this one:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

Keep in mind this must be the first line in the file, before the <html> tag.

David
Thanks Mr. David. But this statement has been already written there in page.
Kamlesh
A: 

position:relative alone doesnt really mean anything. position:relative should be applied to parent of the div. and you should put position:absolute instead of relative.

Funky Dude