Responsive iframe (google maps) and weird resizing

后端 未结 1 1543
忘了有多久
忘了有多久 2020-12-07 10:09

I am trying to add a Google Map to my design, that is supposed to be responsive. I\'ve used the same code that works out for images... But for some reason, the map\'s iframe

1条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 10:40

    This solution is from Dave Rupert / Chris Coyier (I think). It requires a wrapper div but works pretty well.

    HTML

        
    

    CSS

    .iframe-rwd  {
    position: relative;
    padding-bottom: 65.25%;
    padding-top: 30px;
    height: 0;
    overflow: hidden;
    }
    .iframe-rwd iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    }
    

    0 讨论(0)
提交回复
热议问题