Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Elements

0/1

HTML Attributes

0/1

HTML Headings

0/1

HTML Paragraphs

0/1

HTML Styles

0/1

HTML Formatting

0/1

HTML Quotation

0/1

HTML Comments

0/1

HTML Colors

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Block and Inline

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML - The Head Element

0/1

HTML Style Guide

0/1

HTML Entities

0/1

HTML Symbols

0/1
Text lesson

HTML YouTube

Struggling with Video Formats?

Converting videos to various formats can be challenging and time-consuming.

A more convenient approach is to embed YouTube videos directly on your web page for playback.

YouTube Video

When you save or play a video on YouTube, it displays an ID (like tgbNymZ7vqY) that you can use to reference your video in HTML code.

Playing a YouTube Video in HTML

To play your video on a web page, follow these steps:

  1. Upload the video to YouTube.
  2. Note down the video ID.
  3. Define an <iframe> element in your web page.
  4. Set the src attribute to point to the video URL.
  5. Use the width and height attributes to specify the dimensions of the player.
  6. Optionally, add any other parameters to the URL as needed (see below).

Example

<iframe width=”420″ height=”315″
src=”https://www.youtube.com/embed/tgbNymZ7vqY”
>

</iframe>

YouTube Autoplay + Mute

You can enable your video to start playing automatically when a user visits the page by adding autoplay=1 to the YouTube URL.

However, note that automatically starting a video can be intrusive for your visitors.

Note that in Chromium browsers, autoplay is generally restricted. However, muted autoplay is consistently permitted.

To allow your video to start playing automatically (but muted), add mute=1 after autoplay=1 in the YouTube URL.

YouTube – Autoplay + Muted

<iframe width=”420″ height=”315″
src=”https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1&mute=1″
>

</iframe>

YouTube Playlist

A comma-separated list of additional videos to play alongside the original URL.

YouTube Loop

To enable your video to loop indefinitely, add loop=1 to the YouTube URL.

  • Value 0 (default): The video plays only once.
  • Value 1: The video loops indefinitely.

YouTube – Loop

<iframe width=”420″ height=”315″
src=”https://www.youtube.com/embed/tgbNymZ7vqY?playlist=tgbNymZ7vqY&loop=1″
>

</iframe>

YouTube Controls

To hide controls in the video player, add controls=0 to the YouTube URL.

  • Value 0: Player controls are not displayed.
  • Value 1 (default): Player controls are displayed.

YouTube – Controls

<iframe width=”420″ height=”315″
src=”https://www.youtube.com/embed/tgbNymZ7vqY?controls=0″
>

</iframe>