首页 文章

使用元素的Z-Index相对于重叠图像定位

提问于
浏览
1

site:forus-group.com

我试图将右侧导航定位为重叠滑动 Headers 图像 . 无论我给它的z-index有多高,它都不会与图像重叠,其父级部分的z-index为3.两个元素都是粗略的,相对于促进z-index的定位 .

即使我试图给图像本身一个负z-索引,它们仍然与右列重叠 . 相关CSS如下:

#right {
     width: 275px;
     position: relative;
     bottom: 175px;
     z-index: 50;
}

#tophead .cycleitem img {
     position: relative;
     z-index: 1;    
}

给定z-index为50时,所有其他项目(在 Headers 中)都会正确显示 . 提前谢谢 .

EDIT: 网站现在恢复到破碎状态 . 尝试修复IE 7时降低了Bug,但现在出现在现代的brosers中 . 我的 Headers 是全高,下面的内容 . 然后我尝试相对地定位右列:

position: relative;
bottom: 175px;
z-index: 150;

再次感谢 .

1 回答

  • 0

    那是因为菜单实际上位于与 Headers 不同的文档部分中:

    <header id="tophead">
        header image here
    </head>
    <section id="content">
        sidebar menu here
    </section>
    

    如果您希望菜单与 Headers 图像重叠,则'll have to restructure the document. One hack-ish method would be to make the sidebar' s top: -313px ,与 Headers 的高度匹配 .

相关问题