Add a map using HTML

The following example shows how to add a 3d map using only HTML and CSS, not requiring any JavaScript.

CSS

 /* * Always set the map height explicitly to define the size of the div element 
 * that contains the map. 
 */ 
 html 
 , 
 gmp-map-3d 
  
 { 
  
 height 
 : 
  
 100 
 % 
 ; 
 } 
 html 
 , 
 body 
  
 { 
  
 height 
 : 
  
 100 
 % 
 ; 
  
 margin 
 : 
  
 0 
 ; 
  
 padding 
 : 
  
 0 
 ; 
 } 
  

HTML

<html>
  <head>
    <title>Map</title>
    <link rel="stylesheet" type="text/css" href="./style.css" />
  </head>
  <body>
    <gmp-map-3d center="37.7704,-122.3985,500" tilt="67.5" mode="hybrid"></gmp-map-3d>

    <script async
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&v=beta&libraries=maps3d"></script>
  </body>
</html>  

Try Sample

Clone Sample

Git and Node.js are required to run this sample locally. Follow these instructions to install Node.js and NPM. The following commands clone, install dependencies and start the sample application.

  
  git 
  
 clone 
  
 https 
 : 
 //github.com/googlemaps-samples/js-api-samples.git 
 
  
  cd 
  
 samples 
 / 
 3 
 d 
 - 
 simple 
 - 
 map 
 - 
 declarative 
 
  
  npm 
  
 i 
 
  
  npm 
  
 start 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: