I have a landing menu that is made from SVG icons, and now I want to position a div behind these icons, but still inside the menu. Both of these elements have position:fixed
, and top
set as a percentage.
So what I want to do is to have the landingMenu
in the back, then the landingMenuOrangeLine
, then the miniNavButton
(so the buttons are in front)
What I wanted to do is set the z-index
of the elements in question in order to make the buttons appear in front of the div. Now what happens is that I set the z-index
of .miniNavButton
to 2, but when I inspect the element in the developer tools it says z-index:auto
.
Can anyone point out what I'm doing wrong? I've setup a codepen in case you want to play around with it.
my html:
<div class="landingMenu">
<div id="introductionButton" class="miniNavButton" (click)="changeState('landing')">
<a>
<svg class="icon icon-user">
<use xlink:href="symbol-defs.svg#icon-user"></use>
</svg>
</a>
</div>
<div id="skillsButton" class="miniNavButton" (click)="changeState('skills')">
<a>
<svg class="icon icon-book">
<use xlink:href="symbol-defs.svg#icon-book"></use>
</svg>
</a>
</div>
<div id="contactButton" class="miniNavButton" (click)="changeState('contact')">
<a>
<svg class="icon icon-envelop">
<use xlink:href="symbol-defs.svg#icon-envelop"></use>
</svg>
</a>
</div>
</div>
<div id="landingMenuOrangeLine"></div>
my css:
.landingMenu {
top: 1%;
position: fixed;
width: 100%;
border-top: 0.1em solid white;
border-bottom: 0.1em solid white;
padding: 0.5em;
background-color: #00B16A;
}
#landingMenuOrangeLine {
width: 100%;
height: 0.3em;
background-color: #FF4C00;
position: fixed;
top: 5%;
z-index: 1;
}
.miniNavButton {
background-color: #4DC594;
padding: 1em;
margin: 0 7.5%;
border-radius: 50%;
display: inline-block;
z-index: 2;
}
.icon-user,
.icon-book,
.icon-envelop,
.icon-eye,
.icon-embed,
.icon-hammer {
width: 2em;
height: 2em;
}
.contactLink {
display: none;
}