-1

i would like to add text over a video in HTML i have search for 2 hours almost and found nothing, i am new to HTML and dont know what to do

i just need to put text over the video, simple.. but every tutorial just leads me no where and i dont understand it

  1. like how to put css into my html text, i do < style >(css code)< /style > and it does nothing.

i literally just simply want to put text on the screen and have the video in the background but somehow thats so hard, this is so annoying pls help lol.

and i also wanted it centered

  • https://stackoverflow.com/questions/9775853/how-can-i-overlay-a-text-over-another-using-css or https://stackoverflow.com/questions/42475319/html-css-how-to-overlay-text-on-more-text – vee Sep 29 '22 at 04:47
  • Have you tried this: [Add text above HTML5 Video](https://stackoverflow.com/questions/10422105/add-text-above-html5-video) – Zeeshan S. Sep 29 '22 at 04:49

1 Answers1

0

You can make the parent div relative, and put the video inside it with an absolute position text. The final version would be something like this:

.parent {
    position:relative;
}

.text {
    position:absolute;
    top: 0;
    left: 0;
    z-index: 50;
}

<div class="parent">
    <video .. />
    <h2 class="text">Text overlay</h2>
</div>
jhnxx
  • 93
  • 1
  • 6
  • ok i have no idea how to make it look not ugly but hey thanks for the response, im not quite sure how to use this code, my current video code looks like this: ::::::::::: < video autoplay muted loop id="myVideo"> Your browser does not support HTML5 video. < /video> ::::::::::: ,,,,,, i am very new to coding, like 5 hours in python and 5 hours in html so i dont know much about anything, sorry in advance – plshelpmelol Sep 29 '22 at 05:05