📑 Creates a new HTML element and adds it to the page. createElement is an alias.
createElement
Modify the element's CSS style to change its appearance.
style
Use addEventListener to respond to events such as:
addEventListener
q5 adds some extra functionality to the elements it creates:
position
size
x
y
width
height
tag name of the element
Optional
content of the element
element
await Canvas(200);let el = createEl('div', '*');el.position(50, 50);el.size(100, 100);el.style.fontSize = '136px';el.style.textAlign = 'center';el.style.backgroundColor = 'blue';el.style.color = 'white'; Copy
await Canvas(200);let el = createEl('div', '*');el.position(50, 50);el.size(100, 100);el.style.fontSize = '136px';el.style.textAlign = 'center';el.style.backgroundColor = 'blue';el.style.color = 'white';
📑 Creates a new HTML element and adds it to the page.
createElementis an alias.Modify the element's CSS
styleto change its appearance.Use
addEventListenerto respond to events such as:q5 adds some extra functionality to the elements it creates:
positionfunction makes it easy to place the element relative to the canvassizefunction sets the width and height of the elementx,y,width, andheightproperties