Embed Google Map in WordPress post without using iframe or plugin?

I’d like to embed a Google Map into a WordPress post but without using an iframe or a plugin.

I have tried using the following HTML in the post:

Read More
<div id="map_canvas" style="border: 1px solid black;" width="100%" height="500px"></div>

But this gives me a map of zero height. I’d like to use a percentage-width map as I’m using a TwentyEleven child theme, so the site is responsive.

Can anyone suggest how I should style map_canvas so it doesn’t collapse?

Thanks.

Related posts

Leave a Reply

3 comments

  1. If you are willing to use the Google Maps embed code with iframe, you could use a plugin that I wrote called FitMaps. It makes a Google Maps iframe responsive, and is based on the FitVids plugin for responsive video embeds.

    The Fitmaps plugin wraps all Google Maps iframes in a div element and makes the iframe take up 100% width and height of this div. The wrapping div is then easily made responsive with css.

    See: http://www.waywayway.nl/bin/handig-en-leuk/tutorials/responsive-google-maps-embeds/