我希望下面的代码“max-button”是可见的,但它隐藏在网格后面。怎么啦?
<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>下面是两张图片:
maximize.gif:alt text http://www.freeimagehosting.net/uploads/8c213c4a8a.gif grid.gif:alt text http://www.freeimagehosting.net/uploads/af716eaf7d.gif
发布于 2009-11-05 04:01:47
#maxbutton也需要绝对定位。
说明:网格是从默认文档流中取出的,因此按钮最终位于网格将其放置的位置的下方。绝对定位可启用z索引。
https://stackoverflow.com/questions/1676237
复制相似问题