<?xml version="1.0" encoding="utf-8"?>

Embedding YouTube videos

Embedding YouTube videos Bad Practice
Embedding YouTube videos Best Practice

Here's one of the easiest and most popular ways to embed a video on your website:

1. Upload the video on Youtube

2. Copy the HTML code, which you can find when you click the Share button

3. Define an <iframe> element in your web page

4. Insert the code in the src attribute in the HTML document

You're all set! Like with any other video file, you can customize the Youtube video and set its width and height. In addition, you can add autoplay=1 and mute=1 to the Youtube URL to let your video start playing automatically.

Improve your UX & Product skills with interactive courses that actually work