How to make a map in google maps
Creating a map in Google Maps can greatly enhance your website's functionality and user experience by providing easy-to-use navigation and location services.
Basic example
In a few steps you can add a google map to your project:
- In your browser, go to Google Maps and enter the address you want to be visible on the map
- Click the "Share" button
- A new window will pop up. Click on the "Embed a map" tab and copy the provided HTML
- Paste the copied HTML
Adjust the iframe
Bootstrap provides us with classes with which we can adjust the aspect ratio of the iframe. To use them, we need to put our iframe into a wrapper with a ratio
class and a second class that defines our ratio.
For example, if we want our iframe to have an aspect ratio like youtube video thumbnails, we can use the ratio-16x9 class but remember to make this work, we had to remove the iframe's hardcoded height, width, and inline CSS.
Satelite map
If you want a satellite view just set it on google maps before step 2 and it will show a satellite view automatically.
Map within card
Add <div>
with the map to your card and set its width. In the example below, I used the .w-50
class.