div does not track header resizing

Asked

Viewed 38 times

0

I have the following problem, I have a video that is in my tag <header> in it there is a div presentation that there are written texts I wanted when resize the browser that div accompanies the video equal for example the three buttons on the lower right side of my video that are in a div calling for buttonbar follow my header:

body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}
a {
  outline: none;
  text-decoration: none;
}
ul li {
  list-style-type: none;
}
input {
  outline: none;
  cursor: pointer;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
a,
strong {
  font-family: Gabriola;
}
#bg-video {
  background-image: url(../images/overlay.png);
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
}
#video-bg > video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}
/* 1. No object-fit support: */

@media (min-aspect-ratio: 16/9) {
  #video-bg > video {
    height: 300%;
    top: -100%;
  }
}
@media (max-aspect-ratio: 16/9) {
  #video-bg > video {
    width: 300%;
    left: -100%;
  }
}
/* 2. If supporting object-fit, overriding (1): */

@supports (object-fit: cover) {
  #video-bg > video {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
.menu {
  text-align: center;
  z-index: 1;
}
.menu li {
  display: inline;
}
nav img {
  max-width: 95%;
  margin-top: 2%;
  margin: 10px auto;
  text-align: center;
}
.menu li a {
  color: #fff;
  font-size: 1.5em;
  margin: 15px;
}
.menu li a:hover {
  color: #f80;
}
#apresentacao-home {
  text-align: center;
  color: #fff;
}
#apresentacao-home h1 {
  font-size: 4em;
  margin-top: 20%;
  max-width: 100%;
}
#apresentacao-home p {
  font-size: 1.3em;
  width: 550px;
  max-width: 95%;
  margin: -20px auto;
}
#apresentacao-home strong {
  color: #f80;
}
#comecar {
  background-image: url(../images/btn-home.png);
  background-repeat: no-repeat;
  background-position: -284px 0;
  display: block;
  color: #000;
  width: 282px;
  height: 86px;
  font-size: 1.5em;
  text-align: center;
  line-height: 80px;
  margin: 0 auto;
  color: #fff;
}
#comecar:hover {
  background-position: 0 0;
  color: #222;
}
#comecar:active {
  background-position: 0 -48px;
}
#comecar.efeito {
  -webkit-transition: background-position 1s;
  /* Safari */
  transition: background-position 1s;
}
#buttonbar #volDn {
  border-radius: 100%;
  border: 4px solid #fff;
  cursor: pointer;
  -webkit-transform: scale(0.3);
  -o-transform: scale(0.3);
  -ms-transform: scale(0.3);
  -moz-transform: scale(0.3);
  transform: scale(0.3);
  background: transparent;
  outline: none;
}
#buttonbar #volDn:hover {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}
#menos {
  -webkit-transform: scale(0.3);
  -o-transform: scale(0.3);
  -ms-transform: scale(0.3);
  -moz-transform: scale(0.3);
  transform: scale(0.3);
  outline: none;
}
#buttonbar #volUp {
  border-radius: 100%;
  border: 4px solid #fff;
  cursor: pointer;
  -webkit-transform: scale(0.3);
  -o-transform: scale(0.3);
  -ms-transform: scale(0.3);
  -moz-transform: scale(0.3);
  transform: scale(0.3);
  background: transparent;
  outline: none;
}
#buttonbar #volUp:hover {
  background: rgba(255, 255, 255, 0.06);
}
#buttonbar #btn-mais {
  -webkit-transform: scale(0.3);
  -o-transform: scale(0.3);
  -ms-transform: scale(0.3);
  -moz-transform: scale(0.3);
  transform: scale(0.3);
}
#buttonbar #mute {
  border-radius: 100%;
  border: 4px solid #fff;
  cursor: pointer;
  -webkit-transform: scale(0.3);
  -o-transform: scale(0.3);
  -ms-transform: scale(0.3);
  -moz-transform: scale(0.3);
  transform: scale(0.3);
  background: transparent;
  outline: none;
}
#buttonbar #mute:hover {
  background: rgba(255, 255, 255, 0.06);
}
#buttonbar #btn-mudo {
  -webkit-transform: scale(0.5);
  -o-transform: scale(0.5);
  -ms-transform: scale(0.5);
  -moz-transform: scale(0.5);
  transform: scale(0.5);
}
#buttonbar {
  position: absolute;
  bottom: 3%;
  right: 0;
  margin-right: 5%;
  outline: none;
  z-index: 3;
}
#buttonbar button {
  margin: -30px;
  outline: none;
}
<header>
  <nav>
    <ul class="menu">
      <li><a href="#">Sobre</a>
      </li>
      <li><a href="games.html">Games</a>
      </li>
      <li><a href="eventos.html">Evento</a>
      </li>
      <li><a href="team.html">Team</a>
      </li>
      <li><a href="contato.php">Contato</a>
      </li>
      <li><a href="#">Noticias</a>
      </li>
    </ul>
  </nav>


  <div id="apresentacao-home">
    <h1>Ola amigos somos a <strong>Nova Era!</strong></h1>	
    <p>Adipiscing a commodo ante nunc accumsan interdum mi ante adipiscing. A nunc lobortis non nisl amet vis volutpat aclacus nascetur ac non.Lorem curae eu ante amet sapien in tempus ac. Adipiscing id accumsan adipiscing ipsum.</p>
    <a href="#" id="comecar" style="margin-top:5%;">vamos comecar ?</a>
  </div>

  <div id="video-bg">
    <video autoplay loop id="volume-js">
      <!-- Default video source: -->
      <source type="video/mp4" src="video/myvid.mp4" media="(orientation:landscape)">
    </video>
  </div>

  <div id="buttonbar">
    <button id="volDn">
      <img src="images/video/menos.png" id="menos" />
    </button>
    <button id="volUp">
      <img src="images/video/mais.png" id="btn-mais" />
    </button>
    <button id="mute">
      <img src="images/video/som.png" id="btn-mudo" />
    </button>
  </div>
  <div id="bg-video"></div>
</header>

Note: I was having problems with position: absolute I switched to relative only that persists this problem there, I’m trying to fix but it does not work.

1 answer

0

See if this code helps you, in case the video becomes responsive. (class="embed-Responsive-item")

<video autoplay loop id="volume-js" class="embed-responsive-item">
   <!-- Default video source: -->
   <source type="video/mp4" src="myvid.mp4" media="(orientation:landscape)">
</video>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.