Categories
Google Web Development

Set the Width for a Google Maps InfoWindow

Working with Google Maps v3 is way fun.

If you’re a masochist.

Infowindow width
Scrolling InfoWindow
It seems like there’s no easy way to set the width of an InfoWindow. You can set the minWidth parameter, but that does nothing.

If you have content that exceeds the InfoWindow window, you get this: a scrolling box. That’s terrible.

The solution is horribly easy.

Looking Through the InfoWindow
The solution presents itself.
This will solve all your problems, and make you wish you had the past two hours back of your life: use the provided .gm-style-iw class to style the InfoWindow content container.

/* Just use .gm-style-iw */
.gm-style-iw {
width: 300px; 
min-height: 150px;
}

By Zack Katz

Zack Katz is the founder of GravityKit and TrustedLogin. He lives in Leverett, Massachusetts with his wife Juniper.