iframe视频重叠了ios上的填充容器

时间:2018-02-16 18:08:05

标签: html ios css video iframe

当我在ios手机上访问我的网站时,iframe视频与其容器的填充重叠并且如此移动(请参见下面的屏幕截图)。该问题并未出现在其他手机或计算机上(即使使用Chrome移动版)。我用骨架。

shifted iframe video 这是我的HTML:

<html lang="en">
<body class="container">
    <section class="row">
        <div class="twelve columns video-container" title="Funix">
            <iframe class="video" src="https://player.vimeo.com/video/209906189" width="1980" height="1114" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
        </div>
        <div class="six columns small-image nomarginleft" title="Sketches" style="background-image:url(/img/project/funix/funix_sketches.jpg)"> </div>
    </section>
</body>
</html>

和我的css:

html {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%; }

body {
    font-size: 16px;
    font-weight: 400;
    font-family: "OpenSans", "Open Sans", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #222;
    margin: 0;
}

section {
    display: block;
    height: auto;
    padding-bottom: 35px;
    background-color: white;
    box-sizing: content-box;
    padding-left: 15px;
    padding-right: 15px;
}

.columns {
    width: 100%;
    float: left;
    box-sizing: border-box;
}

.video-container {
    position: relative;
    height: 0;
    padding-bottom: 56.25%;
    margin-bottom: 15px;
}

.video {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.small-image {
    height: 0;
    padding-bottom: 70%;
    background-size: cover;
    background-position: center;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    display: flex;
    margin-bottom: 15px;
}

1 个答案:

答案 0 :(得分:0)

只需为移动设备进行转发媒体查询(甚至不需要......)并删除: object-fit: cover; 这是root的原因。我会检查一下:

https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit

像IE这样的浏览器并不友好。