My HTML/CSS UI does not appear in my scene

Hi there, I’m having a problem while trying to do a simple form in HTML and CSS, so
I created an Entity, inside this entity there’s a HTML and a CSS that are intasiated in a UI.js file.

if I open the browser console I can see that the HTML elements are being created but are not visible in my scene while launch.

There’s nothing else in the scene that mighht interfere with the rendering of the UI in the Camera.

https://playcanvas.com/editor/scene/578225

You have one error in your code:

var button = document.getElementByClass("button");

getElementByClass doesn’t exist, getElementsByClass does.

The container for the HTML needs to have a CSS position that isn’t static. I don’t know why, probably something to do with the way the canvas is positioned and sized?

Fixed project: https://playcanvas.com/editor/scene/579143

2 Likes