Simple Map

An example of Google Maps JavaScript API.

by Piara Singh

HTML

<div id="map"></div>
<!-- Replace the API Key with your own -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAJhigwSqqXSzX-eCajfqBPS7c2cSBGri8&callback=initMap" async defer></script>

CSS

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
#map {
  height: 100%;
}

JavaScript

var map;
function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: 28.545643, lng: 77.288872}, 
    zoom: 16
  });
}