How do you style the dropdown on Google Places Autocomplete API?












60














We need to tweak the styling of the dropdown that shows the autocomplete place suggestions when using the Google Places/Maps Autocomplete API.



Does anyone know if this is even possible? If so, I guess we just need to know the CSS classnames/IDs.



There's a screen grab of the bit I am referring to here:



Screengrab >










share|improve this question
























  • Must-have development tool: getfirebug.com That will answer your questions about what's what in the document.
    – Wesley Murch
    Oct 25 '11 at 18:26












  • Thanks for the reply. We've got Firebug and did try looking at the Response for the Autosuggest script but it looks like the data might be encoded? Here's an example row data: ["Sao Paulo - São Paulo, Brazil",null, ["locality","political","geocode"],"CkQ2AAAAmYczUjki5Q7gIrfQPsUYANQF04pl_SDqNY5dGAmkVtZ-VaQHgEsa9LwrSlZ7udzS4tmF808EsRLH5VOYjWJyzxIQ3kMbArn71dQ9Ou2Ezv_GhBoU6LlzspE4kaKqWf_Dck-zde33x2I","fedb05012f42e79f038a58eac44e1bbc61b7c7aa",[["Sao Paulo",0],["São Paulo",12],["Brazil",23]],[[0,2]]] As you can see, there's no nice clean HTML in there we can use to discover what's going on.
    – Oskar Smith
    Oct 26 '11 at 8:01












  • P.S. Sorry, couldn't work out how to get markdown line breaks for the code quote above.
    – Oskar Smith
    Oct 26 '11 at 8:06
















60














We need to tweak the styling of the dropdown that shows the autocomplete place suggestions when using the Google Places/Maps Autocomplete API.



Does anyone know if this is even possible? If so, I guess we just need to know the CSS classnames/IDs.



There's a screen grab of the bit I am referring to here:



Screengrab >










share|improve this question
























  • Must-have development tool: getfirebug.com That will answer your questions about what's what in the document.
    – Wesley Murch
    Oct 25 '11 at 18:26












  • Thanks for the reply. We've got Firebug and did try looking at the Response for the Autosuggest script but it looks like the data might be encoded? Here's an example row data: ["Sao Paulo - São Paulo, Brazil",null, ["locality","political","geocode"],"CkQ2AAAAmYczUjki5Q7gIrfQPsUYANQF04pl_SDqNY5dGAmkVtZ-VaQHgEsa9LwrSlZ7udzS4tmF808EsRLH5VOYjWJyzxIQ3kMbArn71dQ9Ou2Ezv_GhBoU6LlzspE4kaKqWf_Dck-zde33x2I","fedb05012f42e79f038a58eac44e1bbc61b7c7aa",[["Sao Paulo",0],["São Paulo",12],["Brazil",23]],[[0,2]]] As you can see, there's no nice clean HTML in there we can use to discover what's going on.
    – Oskar Smith
    Oct 26 '11 at 8:01












  • P.S. Sorry, couldn't work out how to get markdown line breaks for the code quote above.
    – Oskar Smith
    Oct 26 '11 at 8:06














60












60








60


19





We need to tweak the styling of the dropdown that shows the autocomplete place suggestions when using the Google Places/Maps Autocomplete API.



Does anyone know if this is even possible? If so, I guess we just need to know the CSS classnames/IDs.



There's a screen grab of the bit I am referring to here:



Screengrab >










share|improve this question















We need to tweak the styling of the dropdown that shows the autocomplete place suggestions when using the Google Places/Maps Autocomplete API.



Does anyone know if this is even possible? If so, I guess we just need to know the CSS classnames/IDs.



There's a screen grab of the bit I am referring to here:



Screengrab >







css google-maps autocomplete






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 16 '18 at 0:12









Matt

1787




1787










asked Oct 25 '11 at 18:13









Oskar SmithOskar Smith

384149




384149












  • Must-have development tool: getfirebug.com That will answer your questions about what's what in the document.
    – Wesley Murch
    Oct 25 '11 at 18:26












  • Thanks for the reply. We've got Firebug and did try looking at the Response for the Autosuggest script but it looks like the data might be encoded? Here's an example row data: ["Sao Paulo - São Paulo, Brazil",null, ["locality","political","geocode"],"CkQ2AAAAmYczUjki5Q7gIrfQPsUYANQF04pl_SDqNY5dGAmkVtZ-VaQHgEsa9LwrSlZ7udzS4tmF808EsRLH5VOYjWJyzxIQ3kMbArn71dQ9Ou2Ezv_GhBoU6LlzspE4kaKqWf_Dck-zde33x2I","fedb05012f42e79f038a58eac44e1bbc61b7c7aa",[["Sao Paulo",0],["São Paulo",12],["Brazil",23]],[[0,2]]] As you can see, there's no nice clean HTML in there we can use to discover what's going on.
    – Oskar Smith
    Oct 26 '11 at 8:01












  • P.S. Sorry, couldn't work out how to get markdown line breaks for the code quote above.
    – Oskar Smith
    Oct 26 '11 at 8:06


















  • Must-have development tool: getfirebug.com That will answer your questions about what's what in the document.
    – Wesley Murch
    Oct 25 '11 at 18:26












  • Thanks for the reply. We've got Firebug and did try looking at the Response for the Autosuggest script but it looks like the data might be encoded? Here's an example row data: ["Sao Paulo - São Paulo, Brazil",null, ["locality","political","geocode"],"CkQ2AAAAmYczUjki5Q7gIrfQPsUYANQF04pl_SDqNY5dGAmkVtZ-VaQHgEsa9LwrSlZ7udzS4tmF808EsRLH5VOYjWJyzxIQ3kMbArn71dQ9Ou2Ezv_GhBoU6LlzspE4kaKqWf_Dck-zde33x2I","fedb05012f42e79f038a58eac44e1bbc61b7c7aa",[["Sao Paulo",0],["São Paulo",12],["Brazil",23]],[[0,2]]] As you can see, there's no nice clean HTML in there we can use to discover what's going on.
    – Oskar Smith
    Oct 26 '11 at 8:01












  • P.S. Sorry, couldn't work out how to get markdown line breaks for the code quote above.
    – Oskar Smith
    Oct 26 '11 at 8:06
















Must-have development tool: getfirebug.com That will answer your questions about what's what in the document.
– Wesley Murch
Oct 25 '11 at 18:26






Must-have development tool: getfirebug.com That will answer your questions about what's what in the document.
– Wesley Murch
Oct 25 '11 at 18:26














Thanks for the reply. We've got Firebug and did try looking at the Response for the Autosuggest script but it looks like the data might be encoded? Here's an example row data: ["Sao Paulo - São Paulo, Brazil",null, ["locality","political","geocode"],"CkQ2AAAAmYczUjki5Q7gIrfQPsUYANQF04pl_SDqNY5dGAmkVtZ-VaQHgEsa9LwrSlZ7udzS4tmF808EsRLH5VOYjWJyzxIQ3kMbArn71dQ9Ou2Ezv_GhBoU6LlzspE4kaKqWf_Dck-zde33x2I","fedb05012f42e79f038a58eac44e1bbc61b7c7aa",[["Sao Paulo",0],["São Paulo",12],["Brazil",23]],[[0,2]]] As you can see, there's no nice clean HTML in there we can use to discover what's going on.
– Oskar Smith
Oct 26 '11 at 8:01






Thanks for the reply. We've got Firebug and did try looking at the Response for the Autosuggest script but it looks like the data might be encoded? Here's an example row data: ["Sao Paulo - São Paulo, Brazil",null, ["locality","political","geocode"],"CkQ2AAAAmYczUjki5Q7gIrfQPsUYANQF04pl_SDqNY5dGAmkVtZ-VaQHgEsa9LwrSlZ7udzS4tmF808EsRLH5VOYjWJyzxIQ3kMbArn71dQ9Ou2Ezv_GhBoU6LlzspE4kaKqWf_Dck-zde33x2I","fedb05012f42e79f038a58eac44e1bbc61b7c7aa",[["Sao Paulo",0],["São Paulo",12],["Brazil",23]],[[0,2]]] As you can see, there's no nice clean HTML in there we can use to discover what's going on.
– Oskar Smith
Oct 26 '11 at 8:01














P.S. Sorry, couldn't work out how to get markdown line breaks for the code quote above.
– Oskar Smith
Oct 26 '11 at 8:06




P.S. Sorry, couldn't work out how to get markdown line breaks for the code quote above.
– Oskar Smith
Oct 26 '11 at 8:06












6 Answers
6






active

oldest

votes


















43














If you use firebug (as mentioned in a comment to your question...) you see that the container with the autocomplete results is a DIV with the class "pac-container" and the suggestions are inside it as a DIV with the class "pac-item". so just style with CSS.






share|improve this answer

















  • 2




    Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
    – Oskar Smith
    Nov 17 '11 at 11:45










  • i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
    – DeyyyFF
    Nov 17 '11 at 14:26






  • 2




    also .pac-selected on the .pac-item when you arrow down to a result
    – Aidan Feldman
    Jul 16 '13 at 0:10










  • Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
    – peppelauro
    Oct 22 '14 at 20:02



















104














This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete



enter image description here






share|improve this answer





























    12














    This CSS will allow the drop-down to resize to fit the width of the results:



    .pac-container, .pac-item {
    width: inherit !important;
    }





    share|improve this answer

















    • 1




      Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
      – Matt Murphy
      Mar 8 '16 at 0:21








    • 1




      Perfect, exactly what I was looking for.
      – AntonK
      Feb 9 '17 at 23:42



















    7














    I case anyone is interested in the hierarchy I was able to scrape the following using Firebug:



    <div class="pac-container pac-logo" style="width: 557px; position: absolute; left: 66px; top: 106px; display: none;">
    <div class="pac-item">
    <span class="pac-icon pac-icon-marker"></span>
    <span class="pac-item-query">
    <span>France</span>
    </span>
    </div>
    <div>





    share|improve this answer































      5














      This worked for me, and now I can run this on mobile!



      .pac-container {
      z-index: 10000 !important;
      width: auto !important;
      position: initial !important;
      left: 0 !important;
      right: 0 !important;
      display: block !important;
      }
      .pac-container:empty{
      display: none !important;
      }


      And this somewhere!



      $('selector').append('.pac-container');



      Now the results will show in the selected div as a normal block element :)






      share|improve this answer





















      • be careful though, the display block will cause the list to stay open if you click outside of it
        – Majid
        Mar 8 '18 at 9:38



















      3














      It is pretty difficult to inspect the elements since it closes as soon as it loses focus.



      Though we know that the container has the .pac-container class and items have .pac-item, upon further investigating the API I found that it embeds the CSS styles in the document.



      Here's what initially there, so use it to change the pre-defined styles to fit your needs.



      .pac-container {
      background-color: #fff;
      position: absolute!important;
      z-index: 1000;
      border-radius: 2px;
      border-top: 1px solid #d9d9d9;
      font-family: Arial, sans-serif;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
      -moz-box-sizing: border-box;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      overflow: hidden
      }

      .pac-logo:after {
      content: "";
      padding: 1px 1px 1px 0;
      height: 16px;
      text-align: right;
      display: block;
      background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3.png);
      background-position: right;
      background-repeat: no-repeat;
      background-size: 120px 14px
      }
      .hdpi.pac-logo:after {
      background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png)
      }
      .pac-item {
      cursor: default;
      padding: 0 4px;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
      line-height: 30px;
      text-align: left;
      border-top: 1px solid #e6e6e6;
      font-size: 11px;
      color: #999
      }
      .pac-item:hover {
      background-color: #fafafa
      }
      .pac-item-selected,
      .pac-item-selected:hover {
      background-color: #ebf2fe
      }
      .pac-matched {
      font-weight: 700
      }
      .pac-item-query {
      font-size: 13px;
      padding-right: 3px;
      color: #000
      }
      .pac-icon {
      width: 15px;
      height: 20px;
      margin-right: 7px;
      margin-top: 6px;
      display: inline-block;
      vertical-align: top;
      background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons.png);
      background-size: 34px
      }
      .hdpi .pac-icon {
      background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons_hdpi.png)
      }
      .pac-icon-search {
      background-position: -1px -1px
      }
      .pac-item-selected .pac-icon-search {
      background-position: -18px -1px
      }
      .pac-icon-marker {
      background-position: -1px -161px
      }
      .pac-item-selected .pac-icon-marker {
      background-position: -18px -161px
      }
      .pac-placeholder {
      color: gray
      }





      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7893857%2fhow-do-you-style-the-dropdown-on-google-places-autocomplete-api%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        43














        If you use firebug (as mentioned in a comment to your question...) you see that the container with the autocomplete results is a DIV with the class "pac-container" and the suggestions are inside it as a DIV with the class "pac-item". so just style with CSS.






        share|improve this answer

















        • 2




          Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
          – Oskar Smith
          Nov 17 '11 at 11:45










        • i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
          – DeyyyFF
          Nov 17 '11 at 14:26






        • 2




          also .pac-selected on the .pac-item when you arrow down to a result
          – Aidan Feldman
          Jul 16 '13 at 0:10










        • Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
          – peppelauro
          Oct 22 '14 at 20:02
















        43














        If you use firebug (as mentioned in a comment to your question...) you see that the container with the autocomplete results is a DIV with the class "pac-container" and the suggestions are inside it as a DIV with the class "pac-item". so just style with CSS.






        share|improve this answer

















        • 2




          Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
          – Oskar Smith
          Nov 17 '11 at 11:45










        • i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
          – DeyyyFF
          Nov 17 '11 at 14:26






        • 2




          also .pac-selected on the .pac-item when you arrow down to a result
          – Aidan Feldman
          Jul 16 '13 at 0:10










        • Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
          – peppelauro
          Oct 22 '14 at 20:02














        43












        43








        43






        If you use firebug (as mentioned in a comment to your question...) you see that the container with the autocomplete results is a DIV with the class "pac-container" and the suggestions are inside it as a DIV with the class "pac-item". so just style with CSS.






        share|improve this answer












        If you use firebug (as mentioned in a comment to your question...) you see that the container with the autocomplete results is a DIV with the class "pac-container" and the suggestions are inside it as a DIV with the class "pac-item". so just style with CSS.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 31 '11 at 9:23









        DeyyyFFDeyyyFF

        81379




        81379








        • 2




          Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
          – Oskar Smith
          Nov 17 '11 at 11:45










        • i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
          – DeyyyFF
          Nov 17 '11 at 14:26






        • 2




          also .pac-selected on the .pac-item when you arrow down to a result
          – Aidan Feldman
          Jul 16 '13 at 0:10










        • Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
          – peppelauro
          Oct 22 '14 at 20:02














        • 2




          Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
          – Oskar Smith
          Nov 17 '11 at 11:45










        • i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
          – DeyyyFF
          Nov 17 '11 at 14:26






        • 2




          also .pac-selected on the .pac-item when you arrow down to a result
          – Aidan Feldman
          Jul 16 '13 at 0:10










        • Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
          – peppelauro
          Oct 22 '14 at 20:02








        2




        2




        Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
        – Oskar Smith
        Nov 17 '11 at 11:45




        Excellent, thank you! I can confirm these are indeed the class names for the dropdown and can be used to style the dropdown. You can also change the width of the maps auto-complete dropdown using min-width. i.e. min-width:250px;
        – Oskar Smith
        Nov 17 '11 at 11:45












        i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
        – DeyyyFF
        Nov 17 '11 at 14:26




        i needed to reposition the results and i did it with a padding on the input field for the autocomplete. this doesnt affect the position of the text in the inputfield but the position of the autocomplete results.
        – DeyyyFF
        Nov 17 '11 at 14:26




        2




        2




        also .pac-selected on the .pac-item when you arrow down to a result
        – Aidan Feldman
        Jul 16 '13 at 0:10




        also .pac-selected on the .pac-item when you arrow down to a result
        – Aidan Feldman
        Jul 16 '13 at 0:10












        Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
        – peppelauro
        Oct 22 '14 at 20:02




        Many thanks, as I read "pac-container" I understood everything!!! Many thanks again!
        – peppelauro
        Oct 22 '14 at 20:02













        104














        This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete



        enter image description here






        share|improve this answer


























          104














          This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete



          enter image description here






          share|improve this answer
























            104












            104








            104






            This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete



            enter image description here






            share|improve this answer












            This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete



            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 20 '13 at 7:41









            UserUser

            23.7k51139219




            23.7k51139219























                12














                This CSS will allow the drop-down to resize to fit the width of the results:



                .pac-container, .pac-item {
                width: inherit !important;
                }





                share|improve this answer

















                • 1




                  Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
                  – Matt Murphy
                  Mar 8 '16 at 0:21








                • 1




                  Perfect, exactly what I was looking for.
                  – AntonK
                  Feb 9 '17 at 23:42
















                12














                This CSS will allow the drop-down to resize to fit the width of the results:



                .pac-container, .pac-item {
                width: inherit !important;
                }





                share|improve this answer

















                • 1




                  Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
                  – Matt Murphy
                  Mar 8 '16 at 0:21








                • 1




                  Perfect, exactly what I was looking for.
                  – AntonK
                  Feb 9 '17 at 23:42














                12












                12








                12






                This CSS will allow the drop-down to resize to fit the width of the results:



                .pac-container, .pac-item {
                width: inherit !important;
                }





                share|improve this answer












                This CSS will allow the drop-down to resize to fit the width of the results:



                .pac-container, .pac-item {
                width: inherit !important;
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 15 '14 at 3:52









                Brett PenningsBrett Pennings

                1,1381219




                1,1381219








                • 1




                  Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
                  – Matt Murphy
                  Mar 8 '16 at 0:21








                • 1




                  Perfect, exactly what I was looking for.
                  – AntonK
                  Feb 9 '17 at 23:42














                • 1




                  Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
                  – Matt Murphy
                  Mar 8 '16 at 0:21








                • 1




                  Perfect, exactly what I was looking for.
                  – AntonK
                  Feb 9 '17 at 23:42








                1




                1




                Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
                – Matt Murphy
                Mar 8 '16 at 0:21






                Easy peasy. Probably saved me up to an hour of crap. Thanks @Brett.
                – Matt Murphy
                Mar 8 '16 at 0:21






                1




                1




                Perfect, exactly what I was looking for.
                – AntonK
                Feb 9 '17 at 23:42




                Perfect, exactly what I was looking for.
                – AntonK
                Feb 9 '17 at 23:42











                7














                I case anyone is interested in the hierarchy I was able to scrape the following using Firebug:



                <div class="pac-container pac-logo" style="width: 557px; position: absolute; left: 66px; top: 106px; display: none;">
                <div class="pac-item">
                <span class="pac-icon pac-icon-marker"></span>
                <span class="pac-item-query">
                <span>France</span>
                </span>
                </div>
                <div>





                share|improve this answer




























                  7














                  I case anyone is interested in the hierarchy I was able to scrape the following using Firebug:



                  <div class="pac-container pac-logo" style="width: 557px; position: absolute; left: 66px; top: 106px; display: none;">
                  <div class="pac-item">
                  <span class="pac-icon pac-icon-marker"></span>
                  <span class="pac-item-query">
                  <span>France</span>
                  </span>
                  </div>
                  <div>





                  share|improve this answer


























                    7












                    7








                    7






                    I case anyone is interested in the hierarchy I was able to scrape the following using Firebug:



                    <div class="pac-container pac-logo" style="width: 557px; position: absolute; left: 66px; top: 106px; display: none;">
                    <div class="pac-item">
                    <span class="pac-icon pac-icon-marker"></span>
                    <span class="pac-item-query">
                    <span>France</span>
                    </span>
                    </div>
                    <div>





                    share|improve this answer














                    I case anyone is interested in the hierarchy I was able to scrape the following using Firebug:



                    <div class="pac-container pac-logo" style="width: 557px; position: absolute; left: 66px; top: 106px; display: none;">
                    <div class="pac-item">
                    <span class="pac-icon pac-icon-marker"></span>
                    <span class="pac-item-query">
                    <span>France</span>
                    </span>
                    </div>
                    <div>






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 18 '18 at 7:28









                    Community

                    11




                    11










                    answered Jul 8 '16 at 9:26









                    apebeastapebeast

                    273214




                    273214























                        5














                        This worked for me, and now I can run this on mobile!



                        .pac-container {
                        z-index: 10000 !important;
                        width: auto !important;
                        position: initial !important;
                        left: 0 !important;
                        right: 0 !important;
                        display: block !important;
                        }
                        .pac-container:empty{
                        display: none !important;
                        }


                        And this somewhere!



                        $('selector').append('.pac-container');



                        Now the results will show in the selected div as a normal block element :)






                        share|improve this answer





















                        • be careful though, the display block will cause the list to stay open if you click outside of it
                          – Majid
                          Mar 8 '18 at 9:38
















                        5














                        This worked for me, and now I can run this on mobile!



                        .pac-container {
                        z-index: 10000 !important;
                        width: auto !important;
                        position: initial !important;
                        left: 0 !important;
                        right: 0 !important;
                        display: block !important;
                        }
                        .pac-container:empty{
                        display: none !important;
                        }


                        And this somewhere!



                        $('selector').append('.pac-container');



                        Now the results will show in the selected div as a normal block element :)






                        share|improve this answer





















                        • be careful though, the display block will cause the list to stay open if you click outside of it
                          – Majid
                          Mar 8 '18 at 9:38














                        5












                        5








                        5






                        This worked for me, and now I can run this on mobile!



                        .pac-container {
                        z-index: 10000 !important;
                        width: auto !important;
                        position: initial !important;
                        left: 0 !important;
                        right: 0 !important;
                        display: block !important;
                        }
                        .pac-container:empty{
                        display: none !important;
                        }


                        And this somewhere!



                        $('selector').append('.pac-container');



                        Now the results will show in the selected div as a normal block element :)






                        share|improve this answer












                        This worked for me, and now I can run this on mobile!



                        .pac-container {
                        z-index: 10000 !important;
                        width: auto !important;
                        position: initial !important;
                        left: 0 !important;
                        right: 0 !important;
                        display: block !important;
                        }
                        .pac-container:empty{
                        display: none !important;
                        }


                        And this somewhere!



                        $('selector').append('.pac-container');



                        Now the results will show in the selected div as a normal block element :)







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Aug 15 '15 at 22:59









                        Jack FranzenJack Franzen

                        603518




                        603518












                        • be careful though, the display block will cause the list to stay open if you click outside of it
                          – Majid
                          Mar 8 '18 at 9:38


















                        • be careful though, the display block will cause the list to stay open if you click outside of it
                          – Majid
                          Mar 8 '18 at 9:38
















                        be careful though, the display block will cause the list to stay open if you click outside of it
                        – Majid
                        Mar 8 '18 at 9:38




                        be careful though, the display block will cause the list to stay open if you click outside of it
                        – Majid
                        Mar 8 '18 at 9:38











                        3














                        It is pretty difficult to inspect the elements since it closes as soon as it loses focus.



                        Though we know that the container has the .pac-container class and items have .pac-item, upon further investigating the API I found that it embeds the CSS styles in the document.



                        Here's what initially there, so use it to change the pre-defined styles to fit your needs.



                        .pac-container {
                        background-color: #fff;
                        position: absolute!important;
                        z-index: 1000;
                        border-radius: 2px;
                        border-top: 1px solid #d9d9d9;
                        font-family: Arial, sans-serif;
                        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
                        -moz-box-sizing: border-box;
                        -webkit-box-sizing: border-box;
                        box-sizing: border-box;
                        overflow: hidden
                        }

                        .pac-logo:after {
                        content: "";
                        padding: 1px 1px 1px 0;
                        height: 16px;
                        text-align: right;
                        display: block;
                        background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3.png);
                        background-position: right;
                        background-repeat: no-repeat;
                        background-size: 120px 14px
                        }
                        .hdpi.pac-logo:after {
                        background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png)
                        }
                        .pac-item {
                        cursor: default;
                        padding: 0 4px;
                        text-overflow: ellipsis;
                        overflow: hidden;
                        white-space: nowrap;
                        line-height: 30px;
                        text-align: left;
                        border-top: 1px solid #e6e6e6;
                        font-size: 11px;
                        color: #999
                        }
                        .pac-item:hover {
                        background-color: #fafafa
                        }
                        .pac-item-selected,
                        .pac-item-selected:hover {
                        background-color: #ebf2fe
                        }
                        .pac-matched {
                        font-weight: 700
                        }
                        .pac-item-query {
                        font-size: 13px;
                        padding-right: 3px;
                        color: #000
                        }
                        .pac-icon {
                        width: 15px;
                        height: 20px;
                        margin-right: 7px;
                        margin-top: 6px;
                        display: inline-block;
                        vertical-align: top;
                        background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons.png);
                        background-size: 34px
                        }
                        .hdpi .pac-icon {
                        background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons_hdpi.png)
                        }
                        .pac-icon-search {
                        background-position: -1px -1px
                        }
                        .pac-item-selected .pac-icon-search {
                        background-position: -18px -1px
                        }
                        .pac-icon-marker {
                        background-position: -1px -161px
                        }
                        .pac-item-selected .pac-icon-marker {
                        background-position: -18px -161px
                        }
                        .pac-placeholder {
                        color: gray
                        }





                        share|improve this answer




























                          3














                          It is pretty difficult to inspect the elements since it closes as soon as it loses focus.



                          Though we know that the container has the .pac-container class and items have .pac-item, upon further investigating the API I found that it embeds the CSS styles in the document.



                          Here's what initially there, so use it to change the pre-defined styles to fit your needs.



                          .pac-container {
                          background-color: #fff;
                          position: absolute!important;
                          z-index: 1000;
                          border-radius: 2px;
                          border-top: 1px solid #d9d9d9;
                          font-family: Arial, sans-serif;
                          box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
                          -moz-box-sizing: border-box;
                          -webkit-box-sizing: border-box;
                          box-sizing: border-box;
                          overflow: hidden
                          }

                          .pac-logo:after {
                          content: "";
                          padding: 1px 1px 1px 0;
                          height: 16px;
                          text-align: right;
                          display: block;
                          background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3.png);
                          background-position: right;
                          background-repeat: no-repeat;
                          background-size: 120px 14px
                          }
                          .hdpi.pac-logo:after {
                          background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png)
                          }
                          .pac-item {
                          cursor: default;
                          padding: 0 4px;
                          text-overflow: ellipsis;
                          overflow: hidden;
                          white-space: nowrap;
                          line-height: 30px;
                          text-align: left;
                          border-top: 1px solid #e6e6e6;
                          font-size: 11px;
                          color: #999
                          }
                          .pac-item:hover {
                          background-color: #fafafa
                          }
                          .pac-item-selected,
                          .pac-item-selected:hover {
                          background-color: #ebf2fe
                          }
                          .pac-matched {
                          font-weight: 700
                          }
                          .pac-item-query {
                          font-size: 13px;
                          padding-right: 3px;
                          color: #000
                          }
                          .pac-icon {
                          width: 15px;
                          height: 20px;
                          margin-right: 7px;
                          margin-top: 6px;
                          display: inline-block;
                          vertical-align: top;
                          background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons.png);
                          background-size: 34px
                          }
                          .hdpi .pac-icon {
                          background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons_hdpi.png)
                          }
                          .pac-icon-search {
                          background-position: -1px -1px
                          }
                          .pac-item-selected .pac-icon-search {
                          background-position: -18px -1px
                          }
                          .pac-icon-marker {
                          background-position: -1px -161px
                          }
                          .pac-item-selected .pac-icon-marker {
                          background-position: -18px -161px
                          }
                          .pac-placeholder {
                          color: gray
                          }





                          share|improve this answer


























                            3












                            3








                            3






                            It is pretty difficult to inspect the elements since it closes as soon as it loses focus.



                            Though we know that the container has the .pac-container class and items have .pac-item, upon further investigating the API I found that it embeds the CSS styles in the document.



                            Here's what initially there, so use it to change the pre-defined styles to fit your needs.



                            .pac-container {
                            background-color: #fff;
                            position: absolute!important;
                            z-index: 1000;
                            border-radius: 2px;
                            border-top: 1px solid #d9d9d9;
                            font-family: Arial, sans-serif;
                            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
                            -moz-box-sizing: border-box;
                            -webkit-box-sizing: border-box;
                            box-sizing: border-box;
                            overflow: hidden
                            }

                            .pac-logo:after {
                            content: "";
                            padding: 1px 1px 1px 0;
                            height: 16px;
                            text-align: right;
                            display: block;
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3.png);
                            background-position: right;
                            background-repeat: no-repeat;
                            background-size: 120px 14px
                            }
                            .hdpi.pac-logo:after {
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png)
                            }
                            .pac-item {
                            cursor: default;
                            padding: 0 4px;
                            text-overflow: ellipsis;
                            overflow: hidden;
                            white-space: nowrap;
                            line-height: 30px;
                            text-align: left;
                            border-top: 1px solid #e6e6e6;
                            font-size: 11px;
                            color: #999
                            }
                            .pac-item:hover {
                            background-color: #fafafa
                            }
                            .pac-item-selected,
                            .pac-item-selected:hover {
                            background-color: #ebf2fe
                            }
                            .pac-matched {
                            font-weight: 700
                            }
                            .pac-item-query {
                            font-size: 13px;
                            padding-right: 3px;
                            color: #000
                            }
                            .pac-icon {
                            width: 15px;
                            height: 20px;
                            margin-right: 7px;
                            margin-top: 6px;
                            display: inline-block;
                            vertical-align: top;
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons.png);
                            background-size: 34px
                            }
                            .hdpi .pac-icon {
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons_hdpi.png)
                            }
                            .pac-icon-search {
                            background-position: -1px -1px
                            }
                            .pac-item-selected .pac-icon-search {
                            background-position: -18px -1px
                            }
                            .pac-icon-marker {
                            background-position: -1px -161px
                            }
                            .pac-item-selected .pac-icon-marker {
                            background-position: -18px -161px
                            }
                            .pac-placeholder {
                            color: gray
                            }





                            share|improve this answer














                            It is pretty difficult to inspect the elements since it closes as soon as it loses focus.



                            Though we know that the container has the .pac-container class and items have .pac-item, upon further investigating the API I found that it embeds the CSS styles in the document.



                            Here's what initially there, so use it to change the pre-defined styles to fit your needs.



                            .pac-container {
                            background-color: #fff;
                            position: absolute!important;
                            z-index: 1000;
                            border-radius: 2px;
                            border-top: 1px solid #d9d9d9;
                            font-family: Arial, sans-serif;
                            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
                            -moz-box-sizing: border-box;
                            -webkit-box-sizing: border-box;
                            box-sizing: border-box;
                            overflow: hidden
                            }

                            .pac-logo:after {
                            content: "";
                            padding: 1px 1px 1px 0;
                            height: 16px;
                            text-align: right;
                            display: block;
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3.png);
                            background-position: right;
                            background-repeat: no-repeat;
                            background-size: 120px 14px
                            }
                            .hdpi.pac-logo:after {
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png)
                            }
                            .pac-item {
                            cursor: default;
                            padding: 0 4px;
                            text-overflow: ellipsis;
                            overflow: hidden;
                            white-space: nowrap;
                            line-height: 30px;
                            text-align: left;
                            border-top: 1px solid #e6e6e6;
                            font-size: 11px;
                            color: #999
                            }
                            .pac-item:hover {
                            background-color: #fafafa
                            }
                            .pac-item-selected,
                            .pac-item-selected:hover {
                            background-color: #ebf2fe
                            }
                            .pac-matched {
                            font-weight: 700
                            }
                            .pac-item-query {
                            font-size: 13px;
                            padding-right: 3px;
                            color: #000
                            }
                            .pac-icon {
                            width: 15px;
                            height: 20px;
                            margin-right: 7px;
                            margin-top: 6px;
                            display: inline-block;
                            vertical-align: top;
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons.png);
                            background-size: 34px
                            }
                            .hdpi .pac-icon {
                            background-image: url(https://maps.gstatic.com/mapfiles/api-3/images/autocomplete-icons_hdpi.png)
                            }
                            .pac-icon-search {
                            background-position: -1px -1px
                            }
                            .pac-item-selected .pac-icon-search {
                            background-position: -18px -1px
                            }
                            .pac-icon-marker {
                            background-position: -1px -161px
                            }
                            .pac-item-selected .pac-icon-marker {
                            background-position: -18px -161px
                            }
                            .pac-placeholder {
                            color: gray
                            }






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jan 5 '18 at 11:38









                            sintakonte

                            3,90741229




                            3,90741229










                            answered Sep 2 '17 at 9:35









                            Deepak KamatDeepak Kamat

                            1,10111327




                            1,10111327






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7893857%2fhow-do-you-style-the-dropdown-on-google-places-autocomplete-api%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Sphinx de Gizeh

                                Dijon

                                Guerrita