I’m using the .size() function but it isn’t doing anything. I need my checkbox to be bigger, any help?
-Grim
I’m using the .size() function but it isn’t doing anything. I need my checkbox to be bigger, any help?
-Grim
Looks like the p5.dom
library creates a div
which contains an input
and a label
when you call createCheckbox
. You can access the style of the input element with the following
function setup() {
noCanvas();
const checkbox = createCheckbox('label', false);
const box = checkbox.elt.getElementsByTagName('input')[0];
box.style.width = '50px';
box.style.height = '50px';
// Alternative
box.style.transform = 'scale(2)';
}
Styling may be inconsistent across browsers, though. You can see MDN and W3 Schools for more information.