美文网首页
H5视频自适应页面

H5视频自适应页面

作者: 骑着蜗牛去遛狗 | 来源:发表于2016-11-01 18:03 被阅读346次

仿照支付宝首页

Paste_Image.png
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style media="screen" type="text/css">
    html,
    body {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    #vid {
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translateX(-50%) translateY(-50%);
        transform: translateX(-50%) translateY(-50%);
        min-width: 100%;
        min-height: 100%;
        width: auto;
        height: auto;
        z-index: -1000;
        overflow: hidden;
    }
</style>
</head>

<body>
<video id="vid" video autobuffer autoplay>
  <source id="mp4" src="http://grochtdreis.de/fuer-jsfiddle/video/sintel_trailer-480.mp4" type="video/mp4">
</video>
</body>
</html>  

参考地址:http://stackoverflow.com/questions/10797632/simulate-background-sizecover-on-video-or-img

相关文章

网友评论

      本文标题:H5视频自适应页面

      本文链接:https://www.haomeiwen.com/subject/cdwmuttx.html