# Resize canvas in the DOM

**URL:** <https://discourse.processing.org/t/resize-canvas-in-the-dom/34365>\
**Category:** Libraries\
**Created:** [December 29, 2021, 9:40pm UTC](https://discourse.processing.org/t/resize-canvas-in-the-dom/34365 "2021-12-29T21:40:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yonmaor](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@yonmaor](https://discourse.processing.org/u/yonmaor)\
**Post date:** [December 29, 2021, 9:40pm UTC](https://discourse.processing.org/t/resize-canvas-in-the-dom/34365/1 "2021-12-29T21:40:53Z")

</div>

Hey! I’m trying to embed a p5.js program into a website via the DOM. I want to place it in a CSS grid element that’s width is proportional to the window size. Is there a method similar to `.position(x, y)` that will allow me to resize the canvas (i.e. `.size(w, h)` )? If not, is there another trivial way of doing this? Thanks!
