Why :checked does not change the background?

Hello.

Please tell me why checked does not change the background ?

https://jsfiddle.net/arowntx7/
April 3rd 20 at 17:39
3 answers
April 3rd 20 at 17:41
Solution
You need to start from the input state checked, but it can only affect items that are after him
@Eloy Thanks. - margie.Dicke commented on April 3rd 20 at 17:44
April 3rd 20 at 17:43
Solution
This is done somewhat differently:
April 3rd 20 at 17:45
Solution
Because you change the background from the input, not the label
@Eldred_Ondricka But if I do
label:checked{
 background-color: red;
}
nothing will change - margie.Dicke commented on April 3rd 20 at 17:48
@margie.Dicke, the label checked pseudo-class no - adonis.Howe commented on April 3rd 20 at 17:51
@margie.Dicke, - Eldred_Ondricka commented on April 3rd 20 at 17:54

Find more questions by tags CSSHTML