# Canvas can't be resized with css

**URL:** <https://discourse.threejs.org/t/canvas-cant-be-resized-with-css/69454>\
**Category:** Questions\
**Tags:** canvas\
**Created:** [August 19, 2024, 5:37am UTC](https://discourse.threejs.org/t/canvas-cant-be-resized-with-css/69454 "2024-08-19T05:37:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nxrix](https://avatars.discourse-cdn.com/v4/letter/n/74df32/32.png) [@Nxrix](https://discourse.threejs.org/u/Nxrix)\
**Post date:** [August 19, 2024, 5:37am UTC](https://discourse.threejs.org/t/canvas-cant-be-resized-with-css/69454/1 "2024-08-19T05:37:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [August 19, 2024, 8:00am UTC](https://discourse.threejs.org/t/canvas-cant-be-resized-with-css/69454/2 "2024-08-19T08:00:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [August 20, 2024, 7:42pm UTC](https://discourse.threejs.org/t/canvas-cant-be-resized-with-css/69454/3 "2024-08-20T19:42:09Z")

</div>

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.
