Could someone tell me if it's possible to CSS position a video tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could someone tell me if it's possible to CSS position a video tag?

I'm trying to center a video in the center of the screen but no matter what CSS properties I use it doesn't move.

23rd Feb 2020, 3:56 PM
James winnett
James winnett - avatar
4 Answers
0
I figured it out. I hadn't referenced the styleshet. Thankyou for the help, I am sorry for the hassle.
23rd Feb 2020, 4:45 PM
James winnett
James winnett - avatar
+ 2
To the extent of my knowledge, position property works with any element. Although, if you're having problem with specific code, you should link it here so we can have better understanding of what problem you're facing.
23rd Feb 2020, 4:03 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Reason I can see is because you're not specifying width and height of container div.
23rd Feb 2020, 4:30 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
My html code is: <div class="container"> <video controls autoplay class="videoHl2"> <source src="HL2.webm" type="video/webm"> </video> </div> My CSS is: .container { position: relative; } .videoHl2{ position: absolute; left: 0; top: 50%; width: 100%; }
23rd Feb 2020, 4:16 PM
James winnett
James winnett - avatar