How can I make the YouTube player scale to the width of the page but also keep the aspect ratio?

后端 未结 14 2132
一向
一向 2021-01-30 11:09

I have a YouTube video I want to put on my web page.

I want to scale the video to fit to a percent of the users browser but also to keep the aspect ratio.

I hav

14条回答
  •  情深已故
    2021-01-30 11:18

    These work a treat no JS. Responsive single palyer and list player modified from somewhere not sure, no credit sorry. Load your iframe Youtube player inside the div, the style=" " sets the player size, src= your-youtube-ID, add own player options jsfiddle.net/e2d50fym/3/

    Responsive Youtube List player. nocookie(privacy mode), list= your playlistID, change :- autoplay =0, loop=1 jsfiddle.net/e2d50fym/4/

提交回复
热议问题