Howto add YouTube video on you page with responsive design

Task: Add YouTube video on your web page with responsive design

Solution:

<iframe 
  style="width: 100vw; height: calc(100vw/1.77);"
  src="https://www.youtube.com/embed/<id>" 
  frameborder="0" 
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
  allowfullscreen>
</iframe>

Note: Please set your correct YouTube video id instead of <id> in the src link.

Done.

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :