Why is ~ not working in case of .icon class ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is ~ not working in case of .icon class ?

input[type="checkbox"]:checked ~ i{ color:#9f9; } input[type="checkbox"]:checked ~ .icon{ box-shadow: inset 2px 2px 3px grey ; } It the above code , the '~' is working perfectly in case of i tag but not working in class = "icon" ?? Why ?

1st Feb 2020, 4:48 AM
Keshav Kishor Ram
4 Answers
+ 3
Can you write full code on Sololearn Playground and share here. Maybe you did something mistake.
1st Feb 2020, 7:36 AM
A͢J
A͢J - avatar
+ 3
ABHISHEK I found that ~ works on next tag or class or id. But your class is before the checkbox That's Why it's not working. Check this code edited by me Just check the last icons and click on that. https://code.sololearn.com/WqGn9jJSbylr/?ref=app
1st Feb 2020, 5:03 PM
A͢J
A͢J - avatar
2nd Feb 2020, 12:33 AM
Keshav Kishor Ram