# Misplaced DOMElement

**URL:** <https://phaser.discourse.group/t/misplaced-domelement/11438>\
**Category:** Phaser 3\
**Created:** [March 21, 2022, 9:03pm UTC](https://phaser.discourse.group/t/misplaced-domelement/11438 "2022-03-21T21:03:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zwiebelmanfred](https://avatars.discourse-cdn.com/v4/letter/z/a87d85/32.png) [@Zwiebelmanfred](https://phaser.discourse.group/u/Zwiebelmanfred)\
**Post date:** [March 21, 2022, 9:03pm UTC](https://phaser.discourse.group/t/misplaced-domelement/11438/1 "2022-03-21T21:03:32Z")

</div>

Hi all. I hope someone can help me out. In my Scenes “create()” I add a DOMElement and try to put it in the center of game Scene. This is my code:

```javascript
this.add.dom(this.cameras.main.width / 2, this.cameras.main.height / 2).createFromCache("nameform");

```

When loading the page intially, the wrapping **div** is mispositioned and cut off. However after refreshing the page(F5), the **div** is positioned in the center as intended.

I compared the mispositoined and correctly positioned **div** in the browsers DOM-inspector. The only difference I could find was:

mispositioned:

```javascript
transform: matrix(1, 0, 0, 1, 392.5, 326);

```

positioned correctly:

```javascript
transform: matrix(1, 0, 0, 1, 307.5, 123);

```

The wrapping **div** and its styles are generated by Phaser. Does anyone know how to fix this?

Kind regards, Chris.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 22, 2022, 6:37pm UTC](https://phaser.discourse.group/t/misplaced-domelement/11438/2 "2022-03-22T18:37:48Z")

</div>

👋

> **[GitHub - samme/phaser-plugin-debug-game-scale: Shows Phaser 3 Scale Manager...](https://github.com/samme/phaser-plugin-debug-game-scale)**
>
> Shows Phaser 3 Scale Manager state. Contribute to samme/phaser-plugin-debug-game-scale development by creating an account on GitHub.
