Google map

Total Post:113

Points:791
 206  View(s)
Ratings:
Rate this:

How To Add Google Maps With A Marker to a Website ?

  1. Post:140

    Points:984
    Re: Google map

    How To Add Google Maps With A Marker to a Website :

    -Create an HTML page 

    -Add a map with a marker

    -Get an API key

    <!DOCTYPE html> 
    <html>
      <head>
        <style>
          #map {
            width: 100%;
            height: 400px;
            background-color: grey;
          }
        </style>
      </head>
      <body>
        <p>My Google map for Mindstick</p>
        <div id="map"></div>
      </body>
    </html>
    <div id="map"></div>
    
    <!DOCTYPE html> 
    <html>
      <head>
        <style>
          #map {
            height: 400px;
            width: 100%;
           }
        </style>
      </head>
      <body>
        <h3>GFG Google Maps for noida india region</h3>
        <div id="map"></div>
        <script>
          function initMap() {
            var uluru = {lat: 28.501859, lng: 77.410320};
            var map = new google.maps.Map(document.getElementById('map'), {
              zoom: 4,
              center: uluru
            });
            var marker = new google.maps.Marker({
              position: uluru,
              map: map
            });
          }
        </script>
        <script async defer
        src=
    "https://maps.googleapis.com/maps/api/js?key=
    AIzaSyB2bXKNDezDf6YNVc-mindstick.nNHPo4RJb8&callback=initMap">
        </script>
      </body>
    </html>


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!