Lesson 6

Deploy Your First Project | Media Tag | Multi Page Website


Part 1: The Basics - Getting a Video on the Page

The star of the show is the video tag. At its simplest, it just needs to know the source of the video file.

video tag syntax
  • The controls Attribute: The Magic Switch

The controls attribute is a boolean attribute. You don't need to set it to a value (controls="true" is unnecessary); its mere presence turns the feature on.

Result: You now have a fully functional video player on your page, complete with a play/pause button, a timeline scrubber, volume controls, and a fullscreen option. This is the simplest, most effective way to embed a video.

  • Autoplay

This attribute will make the video start playing as soon as the page loads. code Html CRITICAL CAVEAT: Modern browsers (Chrome, Safari, Firefox) will block autoplay with sound because it's a terrible user experience. To make autoplay work, you almost always have to add the muted attribute as well.

  • loop

Makes the video automatically restart from the beginning when it finishes. Great for background videos.

video tag img

Part 2: The audio Tag


audio tag img

The good news is that the audio tag works almost identically to the video tag, just without the visual component.

The Problem: How do we embed a sound file (like a song or a podcast) with player controls?
The Solution: Use the audio tag with the controls attribute.

audio syntax img

Result: A clean audio player with play/pause, a timeline, and volume controls. It uses the same attributes like autoplay, loop, and muted.


3.HTML Entities

entities cheat sheet img