Google Maps with Bootstrap not responsive

前端 未结 9 705
予麋鹿
予麋鹿 2021-01-30 02:11

I\'m using bootstrap and I embedded Google Maps API 3.

#map_canvas isn\'t responsive; it\'s a fixed width.

Also, if I use height: auto

9条回答
  •  猫巷女王i
    2021-01-30 02:44

    Extremely simple. Make the map relative to viewport height using CSS:

    .map {
      height: 80vh;
    }
    

    This specifies that the .map container must be 80% of the viewport height.

提交回复
热议问题