Google Map .InfoWindow Set Height and Width

和自甴很熟 提交于 2019-12-05 01:39:22

It may be that when the html is passed into the map api and parsed out that it doesn't have access to your stylesheet delcarations. Try adding your width as inline style on MarkerPopUp.

<div class = "MarkerPopUp" style="width: 300px;"><div class = "MarkerContext">Text</div></div>

I know, I hate inline styles too, but it could solve your issue in this case.

.gm-style-iw{
    max-height: 10px;
}

Setting style for gm-style-iw does the work!

Use !important in css

.MarkerPopUp {
    height: 300px !important;
    width: 300px !important;
}

You can use wrapper <div> and add style like this <div style='height: 40px; text-align: center'> and add css code .gm-style-iw { max-width: 400px!important;} in your css file;

Neha Sharma

Try following code:

 infowindow = new google.maps.InfoWindow({
        content: "",
        maxWidth: 200 ,
        maxHeight: 400
    });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!