Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
You can write any html text inside document.write() function and then style it using inline style or just adding an id attribute and call it from related css file as normal, like this: JS: Var a=function() { document.write("<h1 id="test ">hello</h1>"); } CSS: #test { /* put any style you want */ }
12th Apr 2021, 10:05 PM
Mhd AlHaj Houssein
Mhd AlHaj Houssein - avatar
+ 2
Farnaz.A you can not use javascript variables inside css, but you can change the style of an element dynamically via javascript's DOM elements, style property. Or you can use css variables to explain this see this code https://code.sololearn.com/Wkd7l4t629p1/?ref=app
11th Apr 2021, 8:15 PM
Matias
Matias - avatar
11th Apr 2021, 8:25 PM
Matias
Matias - avatar
+ 2
Farnaz.A remove the double quot from id attribute and use single quot. https://code.sololearn.com/W8geo1irh1Vw/?ref=app Happy Coding!!
14th Apr 2021, 11:10 AM
Matias
Matias - avatar
+ 2
Farnaz.A You are Welcome!!
14th Apr 2021, 11:15 AM
Matias
Matias - avatar
+ 1
Farnaz.A You Welcome!!
12th Apr 2021, 8:29 AM
Matias
Matias - avatar
+ 1
Farnaz.A you're welcome
13th Apr 2021, 10:52 AM
Mhd AlHaj Houssein
Mhd AlHaj Houssein - avatar
+ 1
great content.
20th Jun 2021, 5:06 AM
Eliud kibrit.
Eliud kibrit. - avatar
+ 1
Python variables Is it possible to assign an integer as a string variable? For example: 1 = “Hello World”
18th Sep 2021, 8:31 PM
Ridhan Makrani