# How to make ThreeJS respect the size of the container when resizing?

**URL:** <https://discourse.threejs.org/t/how-to-make-threejs-respect-the-size-of-the-container-when-resizing/62002>\
**Category:** Questions\
**Tags:** responsive, resize, loaders\
**Created:** [February 27, 2024, 6:06pm UTC](https://discourse.threejs.org/t/how-to-make-threejs-respect-the-size-of-the-container-when-resizing/62002 "2024-02-27T18:06:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![black-littlebird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/black-littlebird/32/45142_2.png) [@black-littlebird](https://discourse.threejs.org/u/black-littlebird)\
**Post date:** [February 27, 2024, 6:06pm UTC](https://discourse.threejs.org/t/how-to-make-threejs-respect-the-size-of-the-container-when-resizing/62002/1 "2024-02-27T18:06:49Z")

</div>

I have a canva already set with a proper width that is responsive. When the page loads, ThreeJS respects the size of the canva and then loads the model accordingly.

The problem is when I resize the page, the canva does not change its size, even if I try to use a function to set the renderer size. If I reload the page with this new “resized” window, the ThreeJS respects and then loads the model accordingly.

[I followed this tutorial from ThreeJS docs](https://threejs.org/manual/#en/responsive).

> **[ThreeJS Fiddling - JSFiddle - Code Playground](https://jsfiddle.net/gxlpes/8x2hpd7j/74/)**
>
> Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.

What is wrong?

---

<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:** [February 28, 2024, 5:39am UTC](https://discourse.threejs.org/t/how-to-make-threejs-respect-the-size-of-the-container-when-resizing/62002/2 "2024-02-28T05:39:22Z")

</div>

You’re threejs logic all looks correct. I think you might just have a problem with your CSS?
