![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
New Coder ![]() Join Date: Apr 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Problem with z-index in IE
I use negative z-index value to put image to background, but IE don't render it (FF renders it right).
My CSS for example: Code:
#background_art{
width: 520px;
height: 280px;
position: absolute;
z-index: -1;
background-color: #FAFAD2;
margin-top: 180px;
margin-left: 476px;
}
|
|
|
|
|
|
PM User | #2 |
|
Senior Coder ![]() Join Date: Nov 2003
Location: Minneapolis, MN
Posts: 2,877
Thanks: 2
Thanked 65 Times in 56 Posts
![]() |
Don't use a negative index. Use a higher positive index on the object you want to bring in front of #background_art.
Or, make #background_art a background image rather than a foreground element. |
|
|
|
|
|
PM User | #3 | |
|
Senior Coder ![]() Join Date: Dec 2006
Location: Copenhagen, Denmark
Posts: 1,246
Thanks: 1
Thanked 5 Times in 5 Posts
![]() |
Quote:
It is Firefox 2 that renders elements with negative z-index wrongly. See comparison chart. However, I checked Gran Paradiso alpha release 2 (Firefox 3) and the bug seems to be fixed. According to CSS 2.1 Appendix E2, elements with negative z-index can never be placed behind the background of the stacking context (although it is stacked below the contents). Example: Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>z-index</title>
<style>
body {
background: orange;
color: black;
}
#one {
position: absolute;
top: 0;
left: 0;
z-index: -1;
background: yellow;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
The yellow box must show behind the text and above the orange background.
<div id="one">
</div>
</body>
</html>
|
|
|
|
|
|
|
PM User | #4 |
|
Senior Coder ![]() Join Date: Sep 2005
Location: Sydney, Australia
Posts: 2,276
Thanks: 0
Thanked 23 Times in 22 Posts
![]() |
Browsers are not required to support negative indexes and so they can be considered the equivalent of not specifying an index at all in those browsers that don't have a proprietary add-on to support them.
__________________
Stephen Helping others to solve their computer problem at http://www.felgall.com/ Web related ebooks and software - http://members.felgall.com/ Focus on Javascript - http://javascript.about.com/ |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Rate This Thread | |
|
|