IE上的黑色边框用于全屏视频

时间:2015-07-09 19:27:51

标签: javascript jquery html css

如何删除下面视频背景上的黑色边框。在IE11中看起来像这样:

enter image description here

在谷歌浏览器中,它看起来像这样:

enter image description here

造成这种差异的原因是什么?我的代码如下:

<style>
#header {
  border-bottom: 0px;
  margin-bottom: 0px;
}
.featured-area {
  margin-top: 0px;
  margin-bottom: 0px;
}
#recent-posts {
  margin-top: 27px;
}
#blurb {
  margin-bottom: 27px;
  width: 75%;
}
.recent-post-box {
  background-color: #f2f2f2;
  padding-top: 4px;
  margin-top: 40px;
}
#logo {
  display: none;
}
#hero {
  position: relative;
  z-index: 1;
  height: 600px;
  width: 100%;
  margin-bottom: 40px;
  vertical-align: middle;
  text-align: center;
}
#hero #bg {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: url("http://www.makemeapro.org/wp-content/uploads/2015/07/hero-cover-modified.jpg");
  opacity: .4;
  max-width:100%;
  height:auto;
  background-size:cover;
}
#hero video {
  width:100%;
  max-width:100%;
  height: 600px;
  object-fit:cover; /* Resize the video to cover parent, like a background-size:cover */
}

#hero #bg {
  /* The styles for #bg remain the same, you'd just need to add */
  /* one more, so the video that overflows the #hero is hidden: */
  overflow:hidden; 
}
#outerDiv {
  width: 100%;
  height: 100%;
}
.btn {
  background: #3498db;
  background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
  background-image: -moz-linear-gradient(top, #3498db, #2980b9);
  background-image: -ms-linear-gradient(top, #3498db, #2980b9);
  background-image: -o-linear-gradient(top, #3498db, #2980b9);
  background-image: linear-gradient(to bottom, #3498db, #2980b9);
  -webkit-border-radius: 28;
  -moz-border-radius: 28;
  border-radius: 28px;
  color: #ffffff;
  font-size: 20px;
  padding: 10px 20px 10px 20px;
  text-decoration: none;
  border: 0px;
  outline: none;
}

.btn:hover {
  background: #3cb0fd;
  background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
  background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
  text-decoration: none;
  cursor: pointer;
}

.blurb-front-text {
  font-size: 1.5em; !important
}
</style>

Fiddle此处。

1 个答案:

答案 0 :(得分:0)

video标记和父div都是位置absolute时,我遇到了同样的问题。 videodiv 需要相对,然后您可以在video上使用此代码:

position: absolute
top: 0
bottom: 0
left: 0
right: 0
z-index: 1
width: 100%
height: 100%
min-height: 100%
min-width: 100%
object-fit: cover
overflow: hidden
相关问题