+ 2

Why can't I find the answer to this question on the web?...

JavaScript- I've looked up_ on google how to give a div element random width or height. But I didn't really find the answer to the question. Do you guys know how to give a div element random width and (or) height.

28th Aug 2019, 2:09 AM
Ginfio
Ginfio - avatar
2 Antworten
0
Cbr✔[ ZeroCharisma ] , thanks I learnt my first Math.random on that code. I have one more Question: I made another div. I gave it random width and height. like this: divB.style.width = width+ "%". Samething for height. The problem is: They both (div and divB) have the same Height and Width. like if ... div is width:50%, height 50%, the divB has width:50%, and height 50%. How can make the two have different Width and height (random)? Would i need to make a different math.random or, is there a better way?. ...
28th Aug 2019, 8:21 PM
Ginfio
Ginfio - avatar