简体   繁体   English

当堆叠在其他(固定)元素后面时,元素上的链接变得不可点击

[英]Links on element become unclickable when stacked behind other (fixed) element

I'm puzzled!我很困惑! The green menu is stacked behind the white header with search field.绿色菜单堆叠在带有搜索字段的白色标题后面。 This is needed to display the page correctly, but now the green menus links become unclickable.这是正确显示页面所必需的,但现在绿色菜单链接变得不可点击。

The white header is position: fixed;白色标题是position: fixed; . . The green menu is not fixed but has z-index -1 because apparently this is the only way to stack it behind the white header.绿色菜单不是固定的,但z-index -1因为显然这是将它堆叠在白色标题后面的唯一方法。

How do I make the links clickable?如何使链接可点击?

Edit:编辑:
I tried z-index: 99;我试过z-index: 99; aswell as z-index: -99;以及z-index: -99; for both elements.对于这两个元素。 Literally the only way to stack the green menu behind the white header is to use a negative z-index number for the green menu.从字面上看,将绿色菜单堆叠在白色标题后面的唯一方法是对绿色菜单使用负 z-index 编号。

Edit 2:编辑2:
I also tried using opacity: .99;我也尝试使用opacity: .99; for the white header but no results.对于白色标题,但没有结果。

在此处输入图片说明

.header {
    margin: 32px 0 0 0;
    padding: 0;
    width: 100%;
    height: 75px;
    background-color: rgba(255,255,255,0.75);
    border-top: 2px solid rgba(55,175,75,1.00);
    border-bottom: 5px solid rgba(55,175,75,1.00);
    box-shadow: 0 5px 10px rgba(0,0,0,0.4);
    position: fixed;
    z-index: 1;
}

#menu {
    position: fixed;
    margin-top: 107px;
    min-height: 40px;
    width: 100%;
    background-color: rgba(55,175,75,1.00);
    border: 1px solid rgba(55,175,75,1.00);
    border-radius: 0;
    z-index: -1;
}

组的z-index为.header作为2和用于#menu为1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM