How do you style the dropdown on Google Places Autocomplete API?
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:

css
add a comment |
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:

css
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
add a comment |
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:

css
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:

css
css
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
add a comment |
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
add a comment |
6 Answers
6
active
oldest
votes
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.
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-selectedon the.pac-itemwhen 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
add a comment |
This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete

add a comment |
This CSS will allow the drop-down to resize to fit the width of the results:
.pac-container, .pac-item {
width: inherit !important;
}
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
add a comment |
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>
add a comment |
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 :)
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
add a comment |
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
}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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-selectedon the.pac-itemwhen 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
add a comment |
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.
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-selectedon the.pac-itemwhen 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
add a comment |
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.
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.
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-selectedon the.pac-itemwhen 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
add a comment |
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-selectedon the.pac-itemwhen 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
add a comment |
This is now documented by google: https://google-developers.appspot.com/maps/documentation/javascript/places-autocomplete#style_autocomplete

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

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

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

answered Nov 20 '13 at 7:41
UserUser
23.7k51139219
23.7k51139219
add a comment |
add a comment |
This CSS will allow the drop-down to resize to fit the width of the results:
.pac-container, .pac-item {
width: inherit !important;
}
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
add a comment |
This CSS will allow the drop-down to resize to fit the width of the results:
.pac-container, .pac-item {
width: inherit !important;
}
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
add a comment |
This CSS will allow the drop-down to resize to fit the width of the results:
.pac-container, .pac-item {
width: inherit !important;
}
This CSS will allow the drop-down to resize to fit the width of the results:
.pac-container, .pac-item {
width: inherit !important;
}
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
add a comment |
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
add a comment |
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>
add a comment |
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>
add a comment |
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>
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>
edited Jan 18 '18 at 7:28
Community♦
11
11
answered Jul 8 '16 at 9:26
apebeastapebeast
273214
273214
add a comment |
add a comment |
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 :)
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
add a comment |
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 :)
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
add a comment |
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 :)
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 :)
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
add a comment |
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
add a comment |
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
}
add a comment |
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
}
add a comment |
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
}
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
}
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
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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