Look at your code, and compare it to @ronpat’s code. Pay particular attention to the placement of each pair of <span>
tags. The difference between the two will affect how they behave.
Of course, if you’d paid attention to what @PaulOB told you in another recent topic of yours, you’d have understood that there is a more semantic way to set this up:
However, as you seem hell-bent on doing things your way rather than the right way, studying the differences between your code and ronpat’s should enable you to fix your version.