Canvas can't be resized with css

Three.js applies a custom css to the canvas and this locks the size and I can’t apply any css to it

You can still apply CSS to threejs canvas as usual, just don’t use setSize since it won’t make much sense in this case

use
renderer.setSize( width, height, false ) if you don’t want it to overwrite your CSS.

The third (underdocumented) boolean parameter controls whether it will also set width/height in the CSS. it defaults to true.

4 Likes