I can’t center the video

Asked

Viewed 2,388 times

2

Guys I’m trying to center the video, trying to use the margin:0 auto; there’s the possibility of me positioning through the padding or something like that, I made the other page exactly like this and was normal, but now I need to put again and will not, have to help me.

HTML

<div id="corpo">
      <h1>Seje Bem Vindo(A)</h1>
      <video controls>
          <source src="img/transpiedade.mp4">
      </video>            
</div>

CSS

#corpo video{
    width: 750px;
    margin:0 auto;
}

inserir a descrição da imagem aqui

1 answer

2

The margin: 0 auto; will only work with block elements. Then just add display: block; on the tag video:

#corpo video{
    width: 750px;
    margin:0 auto;
    display: block;
}
<div id="corpo">
      <h1>Seje Bem Vindo(A)</h1>
      <video controls>
          <source src="img/transpiedade.mp4">
      </video>            
</div>

  • tested here, it worked, thank you!

  • Blz.. Learn how to thank on the [tour].

Browser other questions tagged

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