Set Google Maps Container DIV width and height 100%

后端 未结 12 956
遇见更好的自我
遇见更好的自我 2020-11-28 04:45

I loaded Google Maps API v3 and print Google Map in div. But when set width & height to 100% and auto I can\'t see the Map.

Here is HTML code snippe

12条回答
  •  一向
    一向 (楼主)
    2020-11-28 05:20

    You have to set all parent containers to a 100% width if you want to cover the whole page with it. You have to set an absolute value at width and height for the #content div at the very least.

    body, html {
      height: 100%;
      width: 100%;
    }
    
    div#content {
      width: 100%; height: 100%;
    }
    

提交回复
热议问题