tags:

views:

43

answers:

1

Hi all,

I expect with the following code 'max-button' be visible but it hides behind the grid. What is wrong?

<html>
<head>
<title>Grid</title>
<style>
#sketch {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent url(grid.gif) repeat scroll 0 0;
    z-index: 0;
}
#max-button {
    z-index: 9999;
}
</style>
</head>
<body>
<div id="sketch"></div>
<div id="max-button"><img src="maximize.gif"></div>
</body>
</html>

And here are the two images:

maximize.gif: alt text grid.gif: alt text

+1  A: 

#maxbutton needs to be absolutely positioned as well.

Explanation: the grid is taken out of the default document flow, hence the button is ending up underneath where the grid would have taken it. Absolute positioning enables z-index.

Daniel A. White
Well done! Thanks. SO rocks!
Majid