DEV Community

Cover image for Google Maps direction Implementation with just HTML !
Nischal Dahal
Nischal Dahal

Posted on

3 4

Google Maps direction Implementation with just HTML !

I have implemented google maps get direction
in my website using just HTML !!

Here is how it works ?

when you click on getdirection without adding value it opens external website/app of google maps and shows your position location that you have set value of the hidden input type which have the name daddr.

google image

When you add some location in the placeholder and press get direction it shows ways like this :

uploaded image

index.html

<head>
    <meta charset="UTF-8">
    <title>Css tips</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
</head>

<body>
    <form action="http://maps.google.com/maps" class="map-get" method="get" target="_blank">
        <div style="display: flex; align-items:
              center;justify-content: center;">
            <input style="margin-right: .2em; min-width:
                 20em;" class="input is-link is-rounded is-small" type="text" name="saddr" placeholder="where
                    you at now ?" />
            <input type="hidden" name="daddr" value="Nees' Web
                 Service, Kathmandu 44600" />
            <input type="submit" class="button is-link is-
                rounded is-small" value="Get location" />
        </div>
    </form>
</body>
Enter fullscreen mode Exit fullscreen mode

I am using bulma CSS for fast styling.

don't forgot to center div 😂😂 :

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
Enter fullscreen mode Exit fullscreen mode

And with this implementation you will get this result !

neeswebservices

Thanks for Reading Do check my other posts !

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay