------------------------------------------------------------------------------------------------------------------------------
<div class="labels">
<label for="d1">Click here to roll the dice</label>
<label for="d2">Click here to roll the dice</label>
<label for="d3">Click here to roll the dice</label>
<label for="d4">Click here to roll the dice</label>
<label for="d5">Click here to roll the dice</label>
<label for="d6">Click here to roll the dice</label>
</div>
<br><br><br>
<div class="randomradio">
<input type="radio" id="d1" name="dice">
<input type="radio" id="d2" name="dice">
<input type="radio" id="d3" name="dice">
<input type="radio" id="d4" name="dice">
<input type="radio" id="d5" name="dice">
<input type="radio" id="d6" name="dice">
<p>You got a: <span id="random-value"></span></p>
</div>
<br><br>
<style>
@keyframes changeOrder {
from { z-index: 6;}
to { z-index: 1; }
}
label {
animation: changeOrder 3s infinite linear;
background: #ddd;
cursor: pointer;
display: block;
padding: 1rem;
position: absolute;
x top: 1rem;
user-select: none;
}
label:nth-of-type(1) { animation-delay: 0s; }
label:nth-of-type(2) { animation-delay: -0.5s; }
label:nth-of-type(3) { animation-delay: -1.0s; }
label:nth-of-type(4) { animation-delay: -1.5s; }
label:nth-of-type(5) { animation-delay: -2.0s; }
label:nth-of-type(6) { animation-delay: -2.5s; }
.randomradio {
position: absolute;
xwidth: 100%;
outline:1px solid red;
}
#d1:checked ~ p span::before { content: "1"; }
#d2:checked ~ p span::before { content: "2"; }
#d3:checked ~ p span::before { content: "3"; }
#d4:checked ~ p span::before { content: "4"; }
#d5:checked ~ p span::before { content: "5"; }
#d6:checked ~ p span::before { content: "6"; }
</style>