代码之家  ›  专栏  ›  技术社区  ›  Misha Moroshko Amr Mostafa

在iframe上height=“100%”在Safari中,flex child不起作用

  •  0
  • Misha Moroshko Amr Mostafa  · 技术社区  · 6 年前

    为什么? height="100%" 上 <iframe>

    .flex {
      display: flex;
      flex-direction: column;
      width: 400px;
      height: 300px;
      background-color: #ddd;
    }
    
    .name {
      line-height: 32px;
    }
    
    .flex-grow {
      flex-grow: 1;
    }
    
    iframe {
      width: 100%;
      height: 100%; /* Works in Chrome and Firefox, but not Safari. */
      border: 0;
      background-color: tomato;
    }
    <div class="flex">
      <div class="flex-grow">
        <iframe></iframe>
      </div>
      <div class="name">My iframe</div>
    </div>

    enter image description here

    0 回复  |  直到 6 年前