Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7
You can use JavaScript to change CSS values indirectly through CSS variables. https://code.sololearn.com/Wa725Y80c5ps/?ref=app
20th Apr 2021, 2:42 PM
Calviղ
Calviղ - avatar
+ 5
Yes it's possible but not possible in css file. You can get the element(s) and use javascript to change the style
20th Apr 2021, 12:13 PM
Ernest Brayce
Ernest Brayce - avatar
+ 5
You can't call JS variables into css file because css is not a programming language It is just a style sheet language. A better question is: what you are trying to do? let us help you!
20th Apr 2021, 12:21 PM
Mhd AlHaj Houssein
Mhd AlHaj Houssein - avatar
+ 3
As Simple As This: var bg='blue'; element.style.backgroundColor=bg;
16th Sep 2021, 6:21 PM
Sancho Godinho
Sancho Godinho - avatar