Stay organized with collections Save and categorize content based on your preferences.
Use markers to display single locations on a map. This guide shows you how to use advanced markers. With advanced markers you can create and customize highly performant markers, and make accessible markers that respond to DOM click events and keyboard input. For even deeper customization, advanced markers supports the use of custom HTML and CSS, including the ability to create completely custom markers. For 3D applications you can control the altitude at which a marker appears. Advanced markers are supported on both raster and vector maps (though some features are not available on raster maps). A map ID is required to use Advanced Markers (the DEMO_MAP_ID
can be used).
Get started with advanced markers
Customize color, scale, and icon imageCustomize the default marker's background, glyph, and border color, and adjust marker size.
Replace the default marker icon with a custom SVG or PNG image.
Create custom HTML markersUse custom HTML and CSS to create visually distinctive interactive markers, and create animations.
Make markers respond to click and keyboard eventsMake a marker respond to clicks and keyboard events by adding a click
event listener.
function initMap() { const map = new google.maps.Map(document.getElementById('map'), { center: {lat: 37.4239163, lng: -122.0947209}, zoom: 17, mapId: 'DEMO_MAP_ID', }); const marker = new google.maps.marker.AdvancedMarkerElement({ map, position: {lat: 37.4239163, lng: -122.0947209}, }); marker.addListener('click', ({domEvent, latLng}) => { const {target} = domEvent; // Handle the click event. // ... }); }Set marker altitude and collision behavior
Set the altitude for a marker to make it appear correctly with 3D map elements, and specify how a marker should behave when it collides with another marker or map label. Marker altitude is only supported on vector maps.
Next stepExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-09 UTC."],[[["Advanced markers offer highly performant and customizable options for displaying single locations on Google Maps, including custom HTML and CSS for unique designs."],["They are accessible, responding to DOM click events and keyboard input for enhanced user interaction."],["Customization options include changing color, scale, icon image, and creating custom HTML markers with interactive elements and animations."],["Altitude control is available for 3D applications, enabling precise marker placement in three-dimensional spaces, although this feature is limited to vector maps."],["Advanced markers are compatible with both raster and vector maps, requiring a map ID for implementation, and offer improved performance compared to legacy markers."]]],["Advanced markers allow customization of map markers, including color, scale, and icons (SVG/PNG). Users can employ custom HTML and CSS for unique designs and animations. Markers can be made interactive via `click` event listeners, handling user clicks and keyboard input. Altitude and collision behavior can be defined for 3D maps. A map ID, like `DEMO_MAP_ID`, is needed, and these advanced markers are available on Android, iOS, and JavaScript platforms, supporting both raster and vector maps.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4