The code snippet below inserts the pink div between the track and thumb of the range slider.
Why does it work in other browsers (-webkit-slider-thumb
), but not Firefox (-moz-range-thumb
)?
Element inspector says z-index
has no effect because it’s not a positional element, but the position
has been set to relative
:
Note: Please see my first question (that was closed) for full motivation, context, and code: How to adjust z-index of pseudo-element ::-moz-range-thumb?
main {
position: relative;
width: 200px;
height: 50px;
}
div {
position: absolute;
top: 0;
bottom: 0;
left: 50%;
right: 25%;
background-color: pink;
}
input {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
input::-webkit-slider-thumb {
position: relative;
z-index: 1;
}
input::-moz-range-thumb {
position: relative;
z-index: 1;
}
<main>
<input type="range" />
<div></div>
</main>