Vladimir
Vladimir

Reputation: 453

how to fit the video inside of an iframe?

I am using an iframe tag to play a video, I extended the iframe full width and height of the parent div, like this :

http://dl3.joxi.net/drive/0014/1091/951363/160311/20ac409fd1.jpg

But as you can see the video won't perfectly fit in the iframe.

Is there any way to extend the video (like object-fit does for images) or adapt the iframe to the size of the video ?

Using CSS or JavaScript (preference using CSS).

Upvotes: 0

Views: 760

Answers (1)

Nick
Nick

Reputation: 465

you need 2 separate pages: try this:

page 1
  <iframe width="450" height="260" src='page2.html'>
   </iframe>
page 2
 <video width="420" controls>
   <source src="movie.mp4" type="video/mp4">
   </video>

that way you can fit them together, and make sure width and height of iframe are about 30px more than video itself

Upvotes: 1

Related Questions