HTML5 Videos

HTML5 is the latest version of the HTML standard and it introduces several new features that make it easier to embed and play videos on a web page without the need for additional plug-ins.

The <video> tag is the main way to embed videos in an HTML5 document. The <video> tag is used to embed video files, such as MP4, WebM, and Ogg, in a web page. The basic syntax for the <video> tag is:

<video src="video-file.mp4"></video>

This will create a video player on the web page and the video will start playing automatically. The src attribute is used to specify the location of the video file, and the controls attribute can be added to show the video player controls.

<video src="video-file.mp4" controls></video>

You can also specify multiple sources for the same video to support different video formats, this can be done by adding multiple <source> elements inside the <video> element.

<video controls>
   <source src="video-file.mp4" type="video/mp4">
   <source src="video-file.webm" type="video/webm">
</video>

In addition to the basic embedding, you can also customize the appearance of the video player using CSS and you can use JavaScript to control the video, such as starting and stopping the video and jumping to specific parts of the video.

HTML5 videos also support captions and subtitles using the <track> element, this element allows you to add captions or subtitles to the video and can be used to display text translations for the video in different languages.

<video controls>
  <source src="video-file.mp4" type="video/mp4">
  <track src="captions.vtt" kind="captions" label="English captions" srclang="en" default>
</video>

In summary, HTML5 makes it easy to embed and play videos on a web page without the need for additional plug-ins. The <video> tag is used to embed video files, and you can control the video player’s appearance and behavior using CSS and JavaScript. HTML5 videos also support captions and subtitles using the <track> element. With these features, it’s become very easy to put rich multimedia content on web pages.

HTML Summary

HTML, which stands for Hypertext Markup Language, is the standard language used to create web pages. It is a markup language, which means that it uses a set of tags and attributes to define the structure and layout of a web page.

The basic structure of an HTML document includes a head and a body. The head contains information about the document, such as the title, which is displayed in the browser’s title bar or tab, and meta information, such as keywords and descriptions for search engines. The body contains the actual content of the web page, such as text, images, and links.

Some of the most commonly used HTML tags include:

  • <p> for paragraphs
  • <h1> to <h6> for headings
  • <a> for links
  • <img> for images
  • <div> and <span> for structuring and laying out the content on a web page
  • <ol> and <ul> for ordered and unordered lists
  • <form> for creating forms for user input

In addition to these basic tags, HTML also includes several semantic tags, which provide additional meaning to the content. These include tags such as <header>, <nav>, <main>, <article>, <aside>, <footer> and others, these are used to define the different parts of a web page and give the browser, Search engine a better understanding of the content.

CSS, or Cascading Style Sheets, is used to control the presentation of web pages written in HTML. By separating the presentation of a web page from its content, developers can make global changes to the look and feel of a website by changing a single CSS file, rather than editing the HTML of each individual page.

JavaScript is a scripting language that is often used to add interactivity and dynamic behavior to web pages created with HTML and CSS. It allows developers to create things like drop-down menus, form validation, and image sliders. JavaScript can also be used to make a website more responsive and improve the user experience.

In summary, HTML is the foundation of a web page, used to define its structure and layout. CSS is used to control the presentation of a web page, and JavaScript is used to add interactivity and dynamic behavior. Together, these technologies form the backbone of the modern web.

HTML URLs

Stands for “Uniform Resource Locator.” A URL is the address of a specific webpage or file on the Internet. For example, the URL of the learn scripting website is “https://learnscripting.org/”.

URL – Uniform Resource Locator

Web browsers request pages from web servers by using a URL.

A Uniform Resource Locator (URL) is used to address a document (or other data) on the web.

A web address like https://learnscripting.org/ follows these syntax rules:

Explanation:

  • scheme – defines the type of Internet service (most common is HTTP or HTTPS)
  • prefix – defines a domain prefix (default for HTTP is www)
  • domain – defines the Internet domain name (like w3schools.com)
  • port – defines the port number at the host (default for HTTP is 80)
  • path – defines a path at the server (If omitted: the root directory of the site)
  • filename – defines the name of a document or resource

HTML Media

HTML media refers to the audio and video elements in HTML documents. These elements allow you to include audio and video content in your web pages and applications.

To include audio in an HTML page, you can use the <audio> element:

<audio src="song.mp3" controls></audio>

This will embed an audio player in the page that will allow the user to play and control the audio file. The controls attribute displays the player controls, such as play, pause, and volume.

To include video in an HTML page, you can use the <video> element:

<video src="movie.mp4" controls></video>

This will embed a video player in the page that will allow the user to play and control the video file. As with the <audio> element, the controls attribute displays the player controls.

Both the <audio> and <video> elements support various attributes that allow you to customize their behavior and appearance, such as the poster attribute, which specifies an image to display before the video is played.

I hope this helps! Let me know if you have any questions.

HTML Audio

HTML <audio> element is used to embed sound content in web pages. It may contain one or more audio sources, represented using the src attribute or the <source> element. The browser will choose the most suitable source based on the type and codec specified.

Here is an example of how to use the <audio> element:

<audio controls>
  <source src="song.mp3" type="audio/mpeg">
  <source src="song.ogg" type="audio/ogg">
  Your browser does not support the audio element.
</audio>

The controls attribute adds audio controls, such as play, pause, and volume. The text between the <audio> and </audio> tags will only be displayed in browsers that do not support the <audio> element.

You can also use the <audio> element to add sound effects to your web page by using the autoplay, loop, and muted attributes.

For more information and examples, you can refer to the MDN documentation on the <audio> element.

HTML Object

The <object> element in HTML is used to embed external resources, such as multimedia (e.g., audio, video, Java applets), in an HTML page. It can also be used to embed other types of documents, such as PDFs.

The <object> element is a container for the embedded resource, and it can have several attributes to specify the location of the resource and other properties of the object. The most important attributes are:

  • data: This attribute specifies the URL of the resource to be embedded.
  • type: This attribute specifies the MIME type of resource.
  • width and height: These attributes specify the dimensions of the object.

Here is an example of how to use the <object> element to embed a PDF file in an HTML page:

<object data="myfile.pdf" type="application/pdf" width="800" height="600">
  <p>It looks like you don't have a PDF plugin for this browser. You can <a href="myfile.pdf">click here to download the PDF file.</a></p>
</object>

In this example, the <object> the element will attempt to load the PDF file at the URL “myfile.pdf” and display it in an 800×600 pixel window. If the browser doesn’t have a PDF plugin, the fallback content (the <p> element) will be displayed instead.

You can find more information about the <object> element in the HTML documentation.

HTML YouTube

To embed a YouTube video in an HTML page, you can use the <iframe> element. The src the attribute should contain the URL of the YouTube video, and the width and height attributes should specify the dimensions of the video player.

For example:

<iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ" width="560" height="315" frameborder="0" allowfullscreen></iframe>

This will embed the YouTube video with the URL https://www.youtube.com/watch?v=dQw4w9WgXcQ in the HTML page, with a width of 560 pixels and a height of 315 pixels. The frameborder attribute controls the border around the video player, and the allowfullscreen attribute allows the video to be played in full-screen mode.

You can also customize the video player using the ? the parameter in the URL. For example, to hide the player controls and related videos when the video is finished, you can use the following URL:

https://www.youtube.com/embed/dQw4w9WgXcQ?controls=0&rel=0

You can find more information about customizing the YouTube video player in the YouTube API documentation.

HTML Iframes

An <iframe> is an HTML element that allows you to embed another HTML document within the current document. It is often used to embed external resources such as videos, maps, and interactive content into a web page.

Here is an example of how to use an <iframe> element:

<iframe src="https://www.example.com" width="600" height="400"></iframe>

This example will embed the webpage at “https://www.example.com” into the current HTML document, with a width of 600 pixels and a height of 400 pixels.

You can also use the srcdoc attribute to specify the HTML content to be embedded, instead of an external URL:

<iframe srcdoc="<h1>Hello, World!</h1>" width="600" height="400"></iframe>

In this example, the text “Hello, World!” will be displayed inside the iframe.

Note that iframes can be a security risk if they are used to embed untrusted content, as the embedded content has the same privileges as the main page and can potentially access sensitive information. It is important to only embed trusted content using iframes.

For more information about the <iframe> element and other HTML embedding elements, you can refer to the following resources:

HTML5 New Elements

New Added Elements in HTML 5:

  • <article>: The <article> tag is used to represent an article. More specifically, the content within the <article> tag is independent from the other content of the site (even though it can be related).
  • <aside>: The <aside> tag is used to describe the main object of the web page in a shorter way like a highlighter. It basically identifies the content that is related to the primary content of the web page but does not constitute the main intent of the primary page. The <aside> tag contains mainly author information, links, related content and so on.
  • <figcaption>: The <figurecaption> tag in HTML is used to set a caption to the figure element in a document.
  • <figure>: The <figure> tag in HTML is used to add self-contained content like illustrations, diagrams, photos or codes listing in a document. It is related to main flow but it can be used in any position of a document and the figure goes with the flow of the document and if remove it then it should not affect the flow of the document.
  • <header>: It contains the section heading as well as other content, such as a navigation links, table of contents, etc.
  • <footer>: The <footer> tag in HTML is used to define a footer of HTML document. This section contains the footer information (author information, copyright information, carriers etc). The footer tag are used within body tag. The <footer> tag is new in the HTML 5. The footer elements require a start tag as well as an end tag.
  • <main>: Delineates the main content of the body of a document or web app.
  • <mark>: The <mark> tag in HTML is used to define the marked text. It is used to highlight the part of the text in the paragraph.
  • <nav>: The <nav> tag is used to declaring the navigational section in HTML documents. Websites typically have sections dedicated to navigational links, which enables user to navigate the site. These links can be placed inside a nav tag.
  • <section>: It demarcates a thematic grouping of content.
  • <details>: The <details> tag is used for the content/information which is initially hidden but could be displayed if the user wishes to see it. This tag is used to create interactive widget which user can open or close it. The content of details tag is visible when open the set attributes.
  • <summary>: The <summary> tag in HTML is used to define a summary for the <details> element. The <summary> element is used along with the <details> element and provides a summary visible to the user. When the summary is clicked by the user, the content placed inside the <details> element becomes visible which was previously hidden. The <summary> tag was added in HTMl 5. The <summary> tag requires both starting and ending tag.
  • <time>: The <time> tag is used to display the human-readable data/time. It can also be used to encode dates and times in a machine-readable form. The main advantage for users is that they can offer to add birthday reminders or scheduled events in their calender’s and search engines can produce smarter search results.
  • <bdi>: The <bdi> tag refers to the Bi-Directional Isolation. It differentiate a text from other text that may be formatted in different direction. This tag is used when a user generated text with an unknown directions.
  • <wbr>: The <wbr> tag in HTML stands for word break opportunity and is used to define the position within the text which is treated as a line break by the browser. It is mostly used when the used word is too long and there are chances that the browser may break lines at the wrong place for fitting the text.
  • <datalist>: The <datalist> tag is used to provide autocomplete feature in the HTML files. It can be used with input tag, so that users can easily fill the data in the forms using select the data.
  • <keygen>: The <keygen> tag in HTML is used to specify a key-pair generator field in a form. The purpose of <keygen> element is to provide a secure way to authenticate users. When a from is submitted then two keys are generated, private key and public key. The private key stored locally, and the public key is sent to the server. The public key is used to generate client certificate to authenticate user for future.
  • <output>: The <output> tag in HTML is used to represent the result of a calculation performed by the client-side script such as JavaScript.
  • <progress>: It is used to represent the progress of a task. It is also define that how much work is done and how much is left to download a things. It is not used to represent the disk space or relevant query.
  • <svg>: It is the Scalable Vector Graphics.
  • <canvas>: The <canvas> tag in HTML is used to draw graphics on web page using JavaScript. It can be used to draw paths, boxes, texts, gradient and adding images. By default it does not contains border and text.
  • <audio>: It defines the music or audio content.
  • <embed>: Defines containers for external applications (usually a video player).
  • <source>: It defines the sources for <video> and <audio>.
  • <track>: It defines the tracks for <video> and <audio>.
  • <video>: It defines the video content.

HTML Video

To add a video to an HTML page, you can use the <video> element. This element allows you to embed video files into your web page and customize the way they are displayed.

Here is an example of how to use the <video> element:

<video src="myvideo.mp4" width="320" height="240" controls></video>

This example will embed a video file called “myvideo.mp4” into the HTML page, with a width of 320 pixels and a height of 240 pixels. The “controls” attribute adds video controls (play/pause, volume, etc.) to the video player.

You can also use the <source> element to specify multiple sources for the video, in case the browser does not support the first format:

<video width="320" height="240" controls>
  <source src="myvideo.mp4" type="video/mp4">
  <source src="myvideo.webm" type="video/webm">
  Your browser does not support the video tag.
</video>

In this example, the browser will try to play the MP4 file first, and if it is not supported, it will try the WEBM file. If neither file is supported, the text “Your browser does not support the video tag.” will be displayed.

For more information about the <video> element and other HTML media elements, you can refer to the following resources: