Google My Maps is a great tool for creating custom maps as if it were a GIS. But when we embed a map made with this tool on our website, a top bar appears that lets you do a few things and that perhaps we don’t want to show. Below I explain how to hide the top bar in Google My Maps, so you simply have a clean map to show your users.
Basically, I’ve found one way (that works) to hide this bar on the map. It involves customizing the HTML code used to embed the iframe.
Having tried it, it feels like a hack, but it’s the best I’ve found and, since Google My Maps doesn’t offer anything better, I’m sharing it here. In any case, if you know of another way to do it, I’ll be happy to hear your suggestions and expand this post with a cleaner alternative.
Oh, and if you’re going to suggest using display:none on the bar’s class, and it has worked for you in WordPress, you’ll make me very happy, because I couldn’t get it to work and it was the first thing that occurred to me.
Embedding a Google My Maps map
Embedding a map made with Google My Maps on our websites is very easy. Basically, when we open the map’s menu, there’s an option called Embed on my site.

Once we click it, a pop-up appears with HTML code that we need to copy. It’s basically an iframe that we’ll embed on our website. In WordPress, we’ll do it with a Custom HTML block.

This code usually has roughly this structure:
<iframe src="https://www.google.com/maps/d/u/0/embed?mid=1AC_pkmvLCHtCtdGB5RETjPPjlOdLqfuL&ehbc=2E312F" width="640" height="480"></iframe>
Here we can change the width (width) and height (height) of the block created.
Next, as we said, we insert a Custom HTML block (if we’re in WordPress) and paste this code into it.


When we preview the block or view the website, the result is basically the Google My Maps map with the familiar top bar that annoys us so much.

Now that we have the context, how can we hide this bar? As mentioned earlier, there are two methods. Let’s see.
Hiding the Google My Maps top bar by customizing the iframe code
One way to hide this bar is to customize the iframe code Google My Maps gives us. To do this, we’ll start from this code, which I took from this question on Stack Overflow.
<div style="height:160px; border:2px solid #eee; display:inline-block; overflow:hidden;">
<iframe style="position:relative; top:-30px; border:none;"
src=" Source to the map "
width="What Ever Width" height="What ever height"></iframe>
</div>
First of all, let’s analyze this code:
On line 1 we create a div tag with a style that defines the height (height), adds a border around it (border), tells it to display inline with a defined height and width (display: inline-block), and finally tells it to clip anything that doesn’t fit (overflow: hidden).
On line 2 we have the iframe itself, which differs from the one Google My Maps gives us in that we add a style to it. Basically we tell it to position itself relative to its normal position (position:relative), and we move the map up enough to hide the bar (top: -30px). Finally, we remove the border here (border: none). Everything else stays the same.
The thing is, the Stack Overflow example isn’t quite right, at least in its values, and I had to adjust it a bit, ending up with this:
<div style="height:420px; border:2px solid #eee; display:inline-block; overflow:hidden;">
<iframe style="position:relative; top:-60px; border:none;" src="https://www.google.com/maps/d/u/0/embed?mid=1AC_pkmvLCHtCtdGB5RETjPPjlOdLqfuL&ehbc=2E312F" width="640" height="480"></iframe>
</div>
Basically, on line 2 I had to work out how far up to move the map to hide the bar. In this case -30px wasn’t enough, and -60px worked better.
Once you’ve worked out that amount, on line 1 set the height to the total iframe height minus the margin you cut off on line 2. In my case that’s 480px – 60px = 420px.
This way, as you can see, the map will be perfectly cropped and look much more professional than with that wretched little bar.
Hiding the Google My Maps bar with CSS (doesn’t work for me)
The other hack I came up with is hiding the bar with CSS. This solution is simpler and seems just as much of a botch to me. The problem is that, since we’re trying to change the CSS of an external element, it doesn’t work (at least not for me).
Basically, it involves identifying the CSS class of the map’s top bar and hiding it.
To do this, we’ll use the developer tools available in any browser.


This way, with the inspector we can see which class it is and modify it from WordPress.
Once we’ve found the class, we copy it and go to the WordPress admin panel. Under Appearance > Customize we go to Additional CSS and add the selector with the property that will hide the bar. In this case, we can use either display: none or visibility: hidden.


The result should be exactly the same (in theory because, as I said, it didn’t work for me).
Try it anyway and, if it works for you, I’d love you to tell me how you did it so I can complete this post.
One of the sources where I tried a possible solution was this one, which adds the CSS code with JavaScript, but I couldn’t get that to work either.
In short, Google My Maps still has some things that could be much improved, but it’s a free, very accessible service and the closest thing I know to a GIS (without being one). That said, it’s not one of the Google products that evolves the most.

Leave a Reply