I need to center a graphic element on the map

115
2
Jump to solution
07-07-2022 08:49 AM
stivenstiven
New Contributor III

I want to position the search engine in the middle of the map, I have only found the positions of : "bottom-leading"|"bottom-left"|"bottom-right"|"bottom-trailing"|"top-leading"|"top-left"|"top-right"|"top-trailing"|"manual"

i want this: 

stivenstiven_0-1657207480737.png

 

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

You can use the manual option then position the search component with CSS. This example isn't perfect but it'll show you the general steps

https://codepen.io/kellyhutchins/pen/poLyJwK?editors=100

 

Here's the css that is used in the sample: 

 

      .esri-ui-manual-container>.esri-component.esri-search {
        position: absolute;
        left: calc(50vw - 120px);
        top: 20px;
    }

https://codepen.io/kellyhutchins/pen/poLyJwK?editors=100

View solution in original post

2 Replies
KellyHutchins
Esri Frequent Contributor

You can use the manual option then position the search component with CSS. This example isn't perfect but it'll show you the general steps

https://codepen.io/kellyhutchins/pen/poLyJwK?editors=100

 

Here's the css that is used in the sample: 

 

      .esri-ui-manual-container>.esri-component.esri-search {
        position: absolute;
        left: calc(50vw - 120px);
        top: 20px;
    }

https://codepen.io/kellyhutchins/pen/poLyJwK?editors=100

stivenstiven
New Contributor III

Thank you very much, that worked

0 Kudos