简体   繁体   English

Flex在Internet Explorer上的工作方式有所不同

[英]flex working differently on internet explorer

I have a div that I use as a 100vh of height to show a video on the page, and to center the content inside this div, I use flex. 我有一个div,我将其用作100vh的高度,以在页面上显示视频,并将内容集中在该div内,我使用flex。 However, this doesn't work on IE11 (This scares me because it's the latest version). 但是,这在IE11上不起作用(这使我感到恐惧,因为它是最新版本)。 Is there a way I can make it work? 有什么办法可以使它起作用?

Here's a screenshot at chrome: 这是chrome的屏幕截图:

在此处输入图片说明

Here's a screenshot at IE11: 这是IE11的屏幕截图:

在此处输入图片说明

As you can see, the picture and the slogan go all the way to the top. 如您所见,图片和标语一直到顶部。 Here's the CSS that goes with it: 这是附带的CSS:

.video-container, .video-container video{
    position: relative;
    min-height: 100vh;
    height: auto;
}
.video-container > video{
    position: absolute;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    background: url(../img/creativebg.png);
    background-size: cover;
}
.video-container, .video-whilst{
    display: flex;
    align-content: center;
    align-items: center;
    text-align: center;
    justify-content: center;
    background-color: transparent;
    color: #fff;
    text-shadow: 1px 1px #333;
}

And here's the markup: 这是标记:

 <div class="jumbotron video-container">
            <video autoplay loop muted preload="auto" poster="img/post-video.png">
                <source src="vid/bgvid.mp4" type="video/mp4">
                <source src="vid/bgvid.webm" type="video/webm">
            </video>
            <div>
                <h1 class="title-no-title">SwitchHon</h1>
                <img src="img/brand-switchhon.png">
                <h4 class="h4-switchhon-brand">Ideas a todo mecate</h4>
                <a href="#"><img src="img/down-arrow-circle-md.png" class="center-pic down-arrow pulse-grow"></a>
            </div>
        </div>

Is there a way this can be fixed? 有没有办法解决这个问题?

Basicly: this , seems to work. 基本上: 似乎有效。

container : display:flex + height/width 容器: display:flex + height/width

video : position:absolute; 视频: position:absolute;

content : align-self:center; 内容: align-self:center;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM