JS | HTML how do you ... do this... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JS | HTML how do you ... do this...

I don’t know what to title it. I’m gonna explain it though. Let’s say I have 10 elements. Class = “b”; I want the width to += 10 + “px”; It doesn’t have to be 10 but just for example. So the 1st element would be width 10px 2nd element width 20px 3rd element width 30px ... https://code.sololearn.com/WCU1quD6V3Fe/?ref=app

15th Dec 2019, 10:27 AM
Ginfio
Ginfio - avatar
2 Answers
+ 1
x[i].style.width = (i+1)*80 + "px"
15th Dec 2019, 10:54 AM
Gordon
Gordon - avatar
15th Dec 2019, 12:09 PM
Furkan Mutlu
Furkan Mutlu - avatar