# How to use size() function on external canvas

**URL:** <https://discourse.processing.org/t/how-to-use-size-function-on-external-canvas/34493>\
**Category:** Beginners\
**Created:** [January 7, 2022, 1:15am UTC](https://discourse.processing.org/t/how-to-use-size-function-on-external-canvas/34493 "2022-01-07T01:15:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Errorbot1122](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/errorbot1122/32/14718_2.png) [@Errorbot1122](https://discourse.processing.org/u/Errorbot1122)\
**Post date:** [January 7, 2022, 1:15am UTC](https://discourse.processing.org/t/how-to-use-size-function-on-external-canvas/34493/1 "2022-01-07T01:15:07Z")

</div>

I currently want to use the `size()` method on an external canvas, but I’m worried the size function will change the CSS W/H instead of the W/H attribute itself.

almost like this:

```auto
webglCanvas = select('#mainViewport');
webglCanvasSize = webglCanvas.size(500, 500);

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [January 7, 2022, 2:51am UTC](https://discourse.processing.org/t/how-to-use-size-function-on-external-canvas/34493/2 "2022-01-07T02:51:22Z")

</div>

- [p5js.org/reference/#/p5.Element/elt](http://p5js.org/reference/#/p5.Element/elt)
