Resize canvas in the DOM

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!