# Understanding GUI paddingLeftInPixels

**URL:** <https://forum.babylonjs.com/t/understanding-gui-paddingleftinpixels/33065>\
**Category:** Questions\
**Tags:** gui\
**Created:** [August 15, 2022, 4:51pm UTC](https://forum.babylonjs.com/t/understanding-gui-paddingleftinpixels/33065 "2022-08-15T16:51:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [August 15, 2022, 4:51pm UTC](https://forum.babylonjs.com/t/understanding-gui-paddingleftinpixels/33065/1 "2022-08-15T16:51:35Z")

</div>

I want to build a toggle slider that has a second rectangle that I can programmaticaly position over to the right or left. The following code using `leftInPixels` works fine so I don’t have a problem but initially I was trying to use `paddingLeftInPixels` which was not working as expected and would result in the rectangle disappearing. What’s going on here? Why does it appear to be cropped at the center line?

> **[Babylon.js Playground](https://playground.babylonjs.com/#XCPP9Y%2314935)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Top 5 use `leftInPixels`, bottom 5 use `paddingLeftInPixels`

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/3/d396df187c89f18c0a0aaf0b724fe299bc7d4aea.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 15, 2022, 5:05pm UTC](https://forum.babylonjs.com/t/understanding-gui-paddingleftinpixels/33065/2 "2022-08-15T17:05:26Z")

</div>

cc @RaananW and @carolhmj our GUI gurus 🙂

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [August 16, 2022, 11:07am UTC](https://forum.babylonjs.com/t/understanding-gui-paddingleftinpixels/33065/3 "2022-08-16T11:07:17Z")

</div>

That’s because of the way paddingLeftInPixels work. leftInPixels will move the element but padding left in pixels will add a padding but keep the element’s width. Here is your playground with a slight change:

[Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#XCPP9Y#14942)
