Chrome浏览器中的iframe边框和自动播放功能

时间:2019-04-10 20:16:25

标签: html css google-chrome iframe autoplay

我无法摆脱视频中的iframe边框。每当我将我的视频分配为iframe时,它都会在视频的两侧创建黑色边框。我希望我的视频全屏显示,没有黑色边框。我试过frameborder =“ 0”,border =“ 0”,依此类推。而且没有任何效果。但是,如果可以在Google Chrome浏览器中自动播放视频,则无需使用iframe。我知道Chrome不允许在不静音的情况下自动播放视频,但是当有人降落在页面上时,我确实需要声音。否则,我将无法获得想要的影响。有没有办法通过代码或其他视频代码类型来覆盖此问题?请让我知道是否可以帮忙。

这是HTML:

<!DOCTYPE html>
<html>
<head>
    <!---Bootstrap--->
    
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
      
      <link rel="stylesheet" href="Animation.css">
      
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
        
        <!--Bootstrap meta name-->
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
<!--Metadata from W3 Schools--->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
<!--CSS Style-->
    
</head>
    
    
    <!---Website Content--->
    
<body>
    
<div class = "container">
<div id="myNav" class="overlay">
  <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
  <div class="overlay-content">
    <a href="Animation.html">Home</a>
  <a href="History.html">History</a>
  <a href="Techniques.html">Techniques</a>
  <a href="Production.html">Production</a>
  <a href="Visual_FX.html">Visual FX</a>
    <a href="Characters_&_Gaming.html">Characters & Gaming</a>
      </div>
  </div>
</div>
<span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; </span>

<script>
function openNav() {
  document.getElementById("myNav").style.width = "50%";
}

function closeNav() {
  document.getElementById("myNav").style.width = "0%";
}
</script>
<!--    <h4>Welcome To</h4>-->
    <header>
        The Wonderful World of Animation
    </header>

<!--Video-->
    
    
  <iframe class="embed-responsive-item" src="Animation%20Montage%20-%20HD.mp4"></iframe>


    
<!--
    <video controls autoplay loop id="myVideo">
  <source src="Animation%20Montage%20-%20HD.mp4" type="video/mp4">
        <source src="Animation%20Montage%20-%20HD.webm" type="video/webm">
        <source src="Animation%20Montage%20-%20HD.ogg" type="video/ogv">
</video>
-->
            
    

</body>
</html>

这是CSS:

body{
    margin: 20px;
}


iframe{
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -1;
}

h4{
    
    color: white;
    text-align: center;
    opacity: 0.8;
}

header{
    z-index:2;
    text-align: center;
    color: white;
    font-size: 70px;
    opacity: 0.9;
}

span{
    
        color: white;
        padding: 20px;
    padding-left: 110px;
        z-index: 1;
        border-top: 70px;
    }

.overlay {
  height: 100%;
  width: 0;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0, 0.9);
  overflow-x: hidden;
  transition: 0.5s;
}

.overlay-content {
  position: relative;
  top: 25%;
  width: 100%;
  text-align: center;
  margin-top: 30px;
}

.overlay a {
  padding: 8px;
  text-decoration: none;
  font-size: 36px;
  color: #818181;
  display: block;
  transition: 0.3s;
}

.overlay a:hover, .overlay a:focus {
  color: #f1f1f1;
}

.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
}

@media screen and (max-height: 450px) {
  .overlay a {font-size: 20px}
  .overlay .closebtn {
  font-size: 40px;
  top: 15px;
  right: 35px;
  }
}

0 个答案:

没有答案