# HTML elements positioning

**URL:** <https://forum.playcanvas.com/t/html-elements-positioning/36845>\
**Category:** Help & Support\
**Tags:** ui\
**Created:** [September 5, 2024, 7:14am UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845 "2024-09-05T07:14:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![smokys](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/smokys/32/10988_2.png) [@smokys](https://forum.playcanvas.com/u/smokys)\
**Post date:** [September 5, 2024, 7:14am UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845/1 "2024-09-05T07:14:46Z")

</div>

Hello everyone, im not HTML nor CSS pro but im trying to implement Text input which went well but im stuck on positioning, script where i create this text input is attached to UI element of playcanvas and i thought the position of text input created using html/css would appear on the same position on screen and could be managed in editor, sadly it doesnt, so i was wondering how to get position of UI element and somehow to have the text input element on the same position

![image](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/2/5/25ef02d2b8e5ca0fd5b3b4a5c1a946ef31c1033e.png)

it looks like that but whenever i change size of the screen the button is going with the screen, not with 2D screen in playcanvas like other UI elements, thanks for reply

![image](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/5/8/589d197e9751ffb35b613a00f0dda2d4f53b1c4b.png)

this is how it looks when resizing the screen, i need it to have static position on screen at least

---

<div class="post-metadata">

**Author:** ![Albertos](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/albertos/32/19749_2.png) [@Albertos](https://forum.playcanvas.com/u/Albertos)\
**Post date:** [September 5, 2024, 11:09am UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845/2 "2024-09-05T11:09:07Z")

</div>

Hi @smokys!

There is probably a CSS file in your project. Here you can add `position: static;` at the correct element (or replace the current value). I think this only works if there is also a `width` and `height` property, so maybe you need to add this as well.

You can find more information on the page below.

> **[W3Schools.com](https://www.w3schools.com/css/css_positioning.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![smokys](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/smokys/32/10988_2.png) [@smokys](https://forum.playcanvas.com/u/smokys)\
**Post date:** [September 5, 2024, 12:22pm UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845/3 "2024-09-05T12:22:28Z")

</div>

When i change it to static the whole text input vanishes to the up left screen, and all css attributes are lost as the input is invisible, here is the current css implemented in script

 ![image](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/0/9/099581add996d9daa4a5b1e5e5e165b9e35a53f4.png)

with static position

![image](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/a/d/ad7097b6ed4759f17b6865746c30e7e0c03f0cd0.png)

with absolute

![image](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/9/2/9295903fd7413f5f13d7aaa95771460e37496e66.png)

as you can see with static position it changes its position but also gets invisible you can only see those 2 arrows due to type: number

- again im really newbie with html / css so maybe somebody can notice what i did wrong there, seems like i also need to set up resize listener to adjust text input size to the screen size

---

<div class="post-metadata">

**Author:** ![Albertos](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/albertos/32/19749_2.png) [@Albertos](https://forum.playcanvas.com/u/Albertos)\
**Post date:** [September 5, 2024, 2:38pm UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845/4 "2024-09-05T14:38:39Z")

</div>

There is no easy solution without understanding HTML/CSS.

Do you use a PlayCanvas example project for your text input?

---

<div class="post-metadata">

**Author:** ![smokys](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/smokys/32/10988_2.png) [@smokys](https://forum.playcanvas.com/u/smokys)\
**Post date:** [September 5, 2024, 3:34pm UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845/5 "2024-09-05T15:34:29Z")

</div>

I used to make websites using just html / css about 8 years ago so i remember basics

> [@Albertos](#):
>
> Do you use a PlayCanvas example project for your text input?

- no i dont, i made it on my own somehow, i have listener ready but i cant even initially put text input on the same position as my UI element, i had to manualy set top and left attributes through css… but that is not efficient way, but i think what i can do is to manualy set the input position for most common screen sizes, but i would prefer to have some universal solution so i dont need to waste much time to manually set input position for at least 4 different screen sizes, thats why i have listener ready and would like it to automatically set the position of input to position of UI text element i have, for example if player decides to use landscape mode

---

<div class="post-metadata">

**Author:** ![Albertos](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/albertos/32/19749_2.png) [@Albertos](https://forum.playcanvas.com/u/Albertos)\
**Post date:** [September 5, 2024, 3:58pm UTC](https://forum.playcanvas.com/t/html-elements-positioning/36845/6 "2024-09-05T15:58:41Z")

</div>

Alright, I hope someone can help you.

In the meantime, I suggest to check the topic below.

> [@Text Input for PlayCanvas UI](https://forum.playcanvas.com/t/text-input-for-playcanvas-ui/28304/):
>
> Here is my first pass in adding a way to do input fields for PlayCanvas UI [https://developer.playcanvas.com/en/tutorials/ui-text-input/](https://developer.playcanvas.com/en/tutorials/ui-text-input/) [ezgif.com-gif-maker (17)] On mobile, the input box appears above the on screen keyboard To add this to your project, copy the folder ‘ui-input’ and paste to your own project and add uiInputField script to Element Entities that represent the input area. For an example, copy the Template ‘Text Input Field’ and paste to your own project. Limitatio…
