text 在网页中嵌入响应式Google地图

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 在网页中嵌入响应式Google地图相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">

<head>
    <meta name="author" content="Alan Simpson">
    <meta name="description" content="Embed a Responsive Google Map in your Web Page">

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Google Map Example</title>
    <style>
        /* Style the body and other elements however you like */
        body {
            background: black;
            color: white;
            font-size: 150%;
        }

        /* The iframe contains the map */
        iframe {
            display: block;
            /* The 90vw means 90%, use any width you like */
            width: 90vw;
            /* Calculate the height to maintain original shape,
                but match vw number to that above */
            height: calc(.75 * 90vw);
            /* Optionally, set maximum height and width */
            max-width: 800px;
            max-height: 600px;
            /* If you want the map to the left of subsequent content */
            float: left;
            margin-right: 10px;
            /* Optionally, you can use margin: 1em auto to center */
            border: solid 2px gray;
            box-shadow: 2px 2px 2px silver;
            border-radius: 4px;
        }
    </style>
</head>

<body>
    <!-- The tag below is just a simple copy / paste from Google maps
          with the width and height removed -->
    <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3022.615565192524!2d-73.9876131843148!3d40.74848394331907!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c259a9b30eac9f%3A0xaca05ca48ab5ac2c!2s350+5th+Ave%2C+New+York%2C+NY+10118!5e0!3m2!1sen!2sus!4v1530981553173"
        frameborder="0" style="border:0" allowfullscreen></iframe>
    We're in the Empire State Building, top by any time.
</body>

</html>

以上是关于text 在网页中嵌入响应式Google地图的主要内容,如果未能解决你的问题,请参考以下文章

html 响应式Google地图

html 响应性地嵌入YouTube,Vimeo,Google地图,iframe等

如何将Google Form iframe嵌入具有灵活高度的html css(响应式)

text 添加响应式容器以嵌入wordpress

如何将 Google Map 静态图像保持在流畅/响应式尺寸上

响应式 iframe(谷歌地图)和奇怪的调整大小