Why is ~ not working in case of .icon class ? | SoloLearn: Learn to code for FREE!


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 ?


2/1/2020 4:48:03 AM


4 Answers

New Answer


Can you write full code on Sololearn Playground and share here. Maybe you did something mistake.


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


🅰🅹 - Sʀ. Sᴏғᴛᴡᴀʀᴇ Eɴɢɪɴᴇᴇʀ Wow Thanks a lot❤️😊


🅰🅹 - Sʀ. Sᴏғᴛᴡᴀʀᴇ Eɴɢɪɴᴇᴇʀ Here it is https://code.sololearn.com/WymAJiwNYugo/?ref=app