+ 1
Can we make a block (circle, square) with JS only (no canvas)?
Can we make a block with colors with JS (without canvas) Something like... red rectangle?
3 Answers
+ 4
Yes, you cam, but canvas might be better. You can create DOM elements with javascript, and manipulate them. The following example will make a red circle with the width and height of the 10th of the screen width (if there is an element with the ID "container"):
const circle = document.createElement("div");
circle.stype.width = "10vw";
circle.style.height = "10vw";
circle.style["border-radius"] = "50%";
circle.style.background = "#F00";
document.querySelector("#container").appendChild(circle);
+ 2
But it's only javascript
+ 1
Airree Can JS by itself make a block (no canvas still). no html / css.
JS by itself?