Change content colour | SoloLearn: Learn to code for FREE!


Change content colour

Is there a way for me to change all the colours of the content on the page to either black or white depending on if the use has clicked the button without a if else statement? E.g. the user clicks the button making the bg colour black and the text white.

12/12/2019 2:39:58 PM

farhan bhatti

5 Answers

New Answer


Css vars do the magic...


Ever heard of CSS variables? Its pretty more convenient than manual one-by-one styling with JS. Refer to this link: If you feel its kinda hard or complex for ya... remember we all (especially me, just leave a message if you want) got your back for any of your questions.


Alfred Juma ill try to look up how to use them


Try "toggle class"


SPICEAPPLE 🍎 { active: 0 } thanks ill take a look at it and see if i can understand and use it