iT邦幫忙

0

(求救)ie11 iframe 無法正常顯示height

各位大大好
最近在做一專案,我用iframe崁入一地圖
我在google上顯示是正常
https://ithelp.ithome.com.tw/upload/images/20201102/201251028waTyoDRdg.png

<div class="traffic_map">
                    <iframe height="500" src="https://www.amap.com/search?id=B0FFKD9ZU2&city=440104&geoobj=111.165548%7C37.373752%7C111.289145%7C37.425369&query_type=IDQ&query=%E6%98%9F%E5%AF%B0%E5%9B%BD%E9%99%85%E5%95%86%E4%B8%9A%E4%B8%AD%E5%BF%83&zoom=14" frameborder="0"></iframe>
                </div>
.traffic_map{
    width: 100%;
    height: 100%;
}
iframe{
    width: 100%;
    height: 100%;
    zoom: 5;
    padding: 1rem 0;
    -ms-zoom: 1;
}

但到了IE11 他的height無法正常顯示出來
更改-ms-zoom也只是變得更寬
超出網頁範圍
該如何才能讓它顯示的跟我google一樣
https://ithelp.ithome.com.tw/upload/images/20201102/20125102pDcI5zp3e2.png

有沒有大大也有遇過相同問題,歡迎指教

height 不能是 100%,除非你上一層有給一個數值才行
但是你上一層也是 100%,這樣的話,是無效的
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
通靈亡
iT邦高手 1 級 ‧ 2020-11-02 13:41:44

參考看看,跟你一模一樣的問題
https://stackoverflow.com/questions/19336402/iframe-height-in-doesnt-work-with-ie/21860887

This happens because the browser by default sets the width to 100% for all the block elements, but this is not the default behaviour for the height.

0

height 這個屬性一定得要依附一個固定值。要不然不會有作用。
ie常會碰到很多不必要的地雷。

我要發表回答

立即登入回答