As question said. Does anyone know if that's possible?
And if so, how do I go about doing that?
Its possible, but I would stick to iframe, or maybe the object tag before div.
Develop games in your browser. Powerful, performant & highly capable.
The runtime has to control the position of the canvas in order to know how mouse/touch input event co-ordinates relate to layouts, and to correctly position form controls. That's pretty difficult if it gets placed in a div. It's also not clear why you would want to do that instead of using an iframe.
It was just a thought, since someone told me iframes on mobile was not optimal. But if like you said mouse/touch get messed up with div that's not really desirable.
Citation needed! I'd argue iframes are more secure and more performant, since in the case of cross-origin iframes the browser can put the game frame in its own independent process.