EDIT: Added code and JS-fiddle
I know this is a common question but I have read all the other related questions and I can't seem to work it out. Sorry if I am being dumb?
why is item A above the button div when the z-indexs should mean otherwise?
<html lang="en">
<body>
<div class="RadioContainer">
<div class="RadioButton"> Click Here to Choose </div>
<div class="AnItem" style="transform: translateY(-4.32px); z-index: -1;"> Item A </div>
<div class="AnItem" style="transform: translateY(-4.32px); z-index: -2;"> Item B </div>
</div>
</body>
.Centerer {
height: 100vh;
display: flex;
align-items: center;
flex-direction: column;
}
.RadioContainer {
display: inline-block;
}
.RadioButton {
display: inline-block;
z-index: 10;
background-color: white;
}
.AnItem {
background-color: darkgrey;
}
.TopHalf {
height: 50vh;
}
Here is a JS-fiddle version