PDA

View Full Version : Fixed and Absolute Position in CSS



snap793
31 Aug 2007, 01:12 PM
hello, I've tried all three DTDs but the code for selecting absolute or fixed position with CSS ONLY works for me (in Safari and in Firefox) when I don't have a DTD declared on the page.

as it stands, there is no DTD. here's the address:

http://www.columbia.edu/cu/skiteam/home.html

thanks so much.

Wickham
31 Aug 2007, 03:18 PM
I first added the HTML strict Doctype because all pages should have one and both IE7 and Firefox displayed the same, which is a good sign.

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

I then added px to the positions and all images went where they should be:-

<style type="text/css">
#layer1 {position:fixed; left:125px;top:10px; z-Index:0}
</style>

<style type="text/css">
#layer2 {position:fixed; left:150px;top:15px; z-Index:0}
</style>

<style type="text/css">
#layer3 {position:fixed; left:350px;top:415px; z-Index:3}
</style>

But you need to check IE6 which doesn't support position: fixed but may use position: absolute instead with the same result (but I haven't tested).