Google Maps zoom control is messed up

Google Maps zoom control is messed up

I use the Google Maps API (v.3) to show a map with a couple of markers. I recently noticed that the control used to zoom the map is messed up (it wasn’t always like this). I have no idea what the cause is.

Update
This post originally had a link to a page where you could view the issue, but the link is broken now, so I’ve removed it.

Solutions/Answers:

Solution 1:

Your CSS messed it up. Remove max-width: 100%; in line 814 and zoom controls will look fine again. To avoid such bugs use more specific selectors in your CSS.

Solution 2:

#myMap_canvas img {
    max-width: none;
}

fixed it for me, but I also wanted to point out the comment on the question by @Ben, “This issue doesn’t happen with Bootstrap if you use the is map_canvas as the map div id”. He’s right. I’m not using Bootstrap, but the problem started happening after I changed the div id.

Related:  How to avoid scientific notation for large numbers in JavaScript?

Setting it back to map_canvas fixed it without the max-width change.

<div id="map_canvas"></div>

Solution 3:

If you’re using Bootstrap, just give it “google-maps” class. This worked for me.

As an alternative you might reset everything for the google map div as a kind of last-resort solution:

HTML:

<div class="mappins-map"><div> 

CSS:

.mappins-map img { 
    max-width: none !important; 
    height: auto !important; 
    background: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

Solution 4:

Just share @Max-Favilli answer:

With latest version of google maps api you need this:

<style>
.gm-style img { max-width: none; }
.gm-style label { width: auto; display: inline; }
</style>

Thanks to @Max-Favilli

https://stackoverflow.com/a/19339767/3070027

Solution 5:

If you’re a Twitter Bootstrap user you should add this line to your CSS:

.gmnoprint img { max-width: none; } 

Solution 6:

I had this problem as well and using

.google-maps img {
    max-width: none;
}

didn’t work. I eventually used

.google-maps img {
    max-width: none !important;
}

and it worked like a charm.