Forum Moderators: open

Message Too Old, No Replies

Same code, but two different sites in IE and FF

         

Coug4r

5:44 pm on Jul 18, 2005 (gmt 0)

10+ Year Member



Hi,

I'm experimenting with the div-tag. I'm using HTML and CSS, as shown in the file below. In FF the file is shown correctly, the image stands 200px to the left and 50px from the top. But in IE only the picture is shown in the left-top corner. How come?

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>titel pagina</title>
</head>
<body>
<div style="background-image: url(top_green.gif); position:fixed; top: 50px; left: 200px; width: 240px; height: 118px; z-index: 5;"></div>
</body>
</html>

Trace

6:05 pm on Jul 18, 2005 (gmt 0)

10+ Year Member



<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>titel pagina</title>
</head>
<body>
<div style="background-image: url(top_green.gif); position:absolute; top: 50px; left: 200px; width: 240px; height: 118px; z-index: 5;"></div>
</body>
</html>

That would be my guess.

Span

6:19 pm on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the forums, Coug4r.

"position:fixed;" is not supported by Win/IE. You have to use:

position:absolute;
position:fixed;

.. both, in that order. In Win/IE the div is positioned absolute and scrolls with the page and in other browsers the div is fixed. Or you have to use some script to fix the div.

And you have to fix your DTD too..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

or:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Coug4r

7:37 pm on Jul 18, 2005 (gmt 0)

10+ Year Member



Thx ;-)
I've changed it into absolute because it didn't work with both absolute and fixed like span said.
But I'll make a stylesheet then for IE and one for FF.