I know there’s an Adjacent Sibling combinator.
I know there’s a General Sibling combinator.
Is there a means by which to apply the following using CSS:
For a given set of sibling DIV’s with some attribute “data-num”, with a sibling INPUT with a given value such that it matches one of the data-num’s of the DIV’s, apply a CSS styling to that DIV and all antecedent sibling DIVs. (or, obviously, to all subsequent siblings and not the current value.)
my brain is now trying to tell me the answer is in the data-num.
give the first data-num “1”, give the second data-num “12”, the third “123”, etc, and then use a *= selector, which will work as long as i’m not selecting between more than number of valid single-characters in a string divs.
I am operating in an environment such that when a radio button is selected, the value of #hide is updated.
The collision of the name attributes between the radio buttons and hidden input is intentional and necessary for the previous bullet point to function. The ‘form’ is not submitted in traditional sense, and so the collision has no detrimental effect.
the idea is that it’s an indicator of percentage, or a meter, so to speak.
If the third box is ‘ticked’ (IE: #hide contains the value 3), then boxes 1, 2 , and 3 should be red, to indicate the complete state of the indicator. (because you cant be on level 3, without also having passed levels 1 and 2)
I can’t see a shorter or cleaner way to do what you want in CSS only.
The version I came up with ending up being twice as long although it does colour the elements progressively based on the value and not reverse as in your example…