【问题标题】:object-fit alternative for IE for a video with 100% width and set heightIE 的 object-fit 替代方案,用于具有 100% 宽度和设置高度的视频
【发布时间】:2018-05-26 08:52:48
【问题描述】:

我有一个适合容器的视频,宽度为 100%,固定高度为 750 像素。视频已设置为 object-fit:fill,这可以在所有浏览器上完美运行,除了......你猜对了 IE!我知道 IE 不支持 object-fit 并想知道是否有人知道解决方法?

 #mainContainer {
          width: 100%;
          height: 750px;
          border-bottom: solid 4px #9B51E0;
          position: relative;
          }
 #mainVideo {
          width: 100%;
          height: 750px;
          object-fit: fill;
          position: absolute;
          opacity: 0.85;
          }

 <div id="mainContainer">
     <video id="mainVideo" autoplay loop>
          <source src="video.mp4">
     </video>
 </div>    

【问题讨论】:

    标签: html css


    【解决方案1】:

    一点也不奇怪 ;-) IE 不支持 object-fit 属性,但是有一些 polyfills 可以做到这一点。 我总是用这个:https://github.com/bfred-it/object-fit-images

    编辑: 对于视频 https://github.com/constancecchen/object-fit-polyfill

    【讨论】:

    • 太好了,感谢您的链接!我会检查一下,让你知道我的进展如何。 IE不会打败我!
    • 查看了链接,确实帮助我指出了正确的方向,谢谢!
    猜你喜欢
    • 2013-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 2017-01-20
    • 2015-06-21
    相关资源
    最近更新 更多