How to add a class to the canvas tag (after it is created)? [Solved]

I’m using Bootstrap 4, and while I already am using a function to resize the canvas, it still doesn’t works well.

I realized using img-fluid positions everything exactly how I want; tried it in the Chrome debugger, but I don’t know how to ‘add’ it into the canvas element (which is created by Three,js, I guess)

window.onload = function () {
    let tagCanvas = document.getElementsByTagName('CANVAS')[0];
    tagCanvas.ClassName = 'img-fluid';

Any ideas how I could make this work?

Ah, I just took img-fluid code inside the canvas css. Works.