0

How do you align a video to the center in HTML?

Im trying to make a webpage, but i cant get the darn video to be aligned to the center, why cant it? i know css, so i can use that as well if needed.

6th Oct 2018, 1:03 AM
Stephen Van Der Westhuizen
Stephen Van Der Westhuizen - avatar
5 Answers
+ 1
It depends. Go ahead and post a link to your Code Playground project so we can take a look under the hood.
6th Oct 2018, 6:59 AM
Janningā­
Janningā­ - avatar
+ 1
You need to put iframe in container, like this: <div class="centered"> <iframe ... ></iframe> </div> and then set container' width to fixed and side margins to auto like this: .centered { width: 350px; margin-left: auto; margin-right: auto; }
9th Oct 2018, 4:33 AM
Š•Š»ŠµŠ½Š° ŠšŠ°Ń€Š°Š±Š°ŠµŠ²Š°
Š•Š»ŠµŠ½Š° ŠšŠ°Ń€Š°Š±Š°ŠµŠ²Š° - avatar
+ 1
How big did you want it? iframe {width:100%;} or video {width:100%;} should at least make it not bleed out (overflow) horizontally.
10th Oct 2018, 6:16 PM
Janningā­
Janningā­ - avatar
0
https://code.sololearn.com/WZ71hYEitf8z/?ref=app if you open it with your pc, then you'll see how it actually looks like
6th Oct 2018, 3:26 PM
Stephen Van Der Westhuizen
Stephen Van Der Westhuizen - avatar
0
hello, thank you for your help, but it doesn't seem to be working
10th Oct 2018, 1:50 PM
Stephen Van Der Westhuizen
Stephen Van Der Westhuizen - avatar