最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Why Google map can not show full size in a page?

programmeradmin8浏览0评论

In WordPress page in put google map Embed Code like this

<iframe src="=!1m18!1m12!1m3!1d805184.6317849847!2d144.49269473369353!3d-37.97123702210555!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6ad646b5d2ba4df7%3A0x4045675218ccd90!2sMelbourne+VIC!5e0!3m2!1sen!2sau!4v1501764505542" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

After publish, this part dispear.

  width="600" height="450" 

So, map show up in a very small size, about 200px X 100px

In WordPress page in put google map Embed Code like this

<iframe src="https://www.google/maps/embed?pb=!1m18!1m12!1m3!1d805184.6317849847!2d144.49269473369353!3d-37.97123702210555!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6ad646b5d2ba4df7%3A0x4045675218ccd90!2sMelbourne+VIC!5e0!3m2!1sen!2sau!4v1501764505542" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

After publish, this part dispear.

  width="600" height="450" 

So, map show up in a very small size, about 200px X 100px

Share Improve this question edited Aug 4, 2017 at 0:53 user18787 asked Aug 3, 2017 at 21:38 user18787user18787 33 bronze badges 6
  • 1 WordPress is going to strip out iframes for security reasons, you'll want to use a shortcode instead – Tom J Nowell Commented Aug 3, 2017 at 21:56
  • Sorry, what kind of shortcode, where can I find it? – user18787 Commented Aug 4, 2017 at 0:38
  • Here are some details about shortcodes: codex.wordpress/Shortcode_API – Greeso Commented Aug 4, 2017 at 2:02
  • something wrong in your style.css or theme other wise it's fine with my wordpress setup – Jignesh Patel Commented Aug 4, 2017 at 3:59
  • @user18787 WP doesn't come with such a shortcode out of the box, eitherway you can't use HTML embed codes in WP, instead use OEmbed or shortcodes ( you will need to add support yourself, either by adding a shortcode, or an oembed provider ) – Tom J Nowell Commented Aug 4, 2017 at 18:52
 |  Show 1 more comment

2 Answers 2

Reset to default 0

Try with css styling

iframe {
  width:100%;
  height:450px;
}

or page specific css

.page iframe {
  width:100%;
  height:450px;
}

There is a way to embed your iframe responsive - meaning it takes the full available width of it's container:

.embed-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;  // in case of problems add height: auto; after this line
    overflow: hidden;
    max-width: 100%;
}

.embed-container iframe,
.embed-container object,
.embed-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

Now embed your iframe like this:

<div class="embed-container">
    <iframe src="https://www.yourURL.tld" width="560" height="315" frameborder="0"></iframe>
</div>
发布评论

评论列表(0)

  1. 暂无评论