Images and Multimedia

Images and Multimedia in HTML

Images and Multimedia in HTML.

Embedding images with <img> Tag.

Use the <img> element in HTML to embed different kinds of pictures into your current html web page if you want to incorporate any form of image, graphics, wallpaper, background, or foreground image into an HTML web page. The website has a wide variety of graphics.

Images and Multimedia

The image will now be embedded or inserted into an HTML web page.

<img src=”imagename.png” alt=”All about description of the image”>

Let’s learn more about the HTML img tag now.

  • Picture source (src) – The URL (Uniform Resource Locator) address or storage path of the picture file is the source property. The computer hard disc location where this picture is embedded may be online or offline. which your current html web page should display. A path or relative or absolute image storage location must be specified for the picture file. “imagename.png” is a placeholder in the example above for the path to the real image file.
  • Image Alt (Alternative Text) – The alternative text for the picture is provided by the embed image alt property. This is displayed when an embedded picture on a web page cannot be loaded or seen by a screen reader for visually impaired users. It is required for the image file’s accessibility purposes. This explains the function of the current image or its website. Due to various factors, this image may occasionally not appear online or offline. The visitor can then see information about these photographs thanks to the alt tag.

Here is an illustration of how to insert a whole picture <img> element into an HTML web page.

<img src=”flower.jpg” alt=”Nice image of rose flower”>

Any HTML web page can have extra attributes shown to customize how pictures look. To format or style an image further, as well as to set the height and width of an embedded picture, you can use internal or external CSS.

Img Tag Example in Html

<!DOCTYPE html>

<html>

<head>

    <title>html Image insert tag example</title>

</head>

<body>

    <h1>Img Tag Example in Html</h1>

    <p>Embedding images with <img> Tag in Html.</p>

    <!– Embedding an image from internal source –>

    <img src=”html.jpg” alt=”a nice html image background”>

    <!– Embedding an image from external internet source –>

    <p> Online Image source location- <a href=”https://unsplash.com/photos/Ftx92UKO3Xg”>Chromebook image</a></p>

</body>

</html>

Image attributes: src, alt, width, and height.

Several built-in image characteristics are available when embedding pictures in HTML using the <img> element in any html web page to control different aspects of image presentation and accessibility.

The main characteristics of HTML images are described here.

Real Source for the Image.

The source URL (Uniform Resource Locator) of the image file is specified by the embed image source src element. on your current html web page, which you wish to display. Keep in mind that these picture sources might be either offline or online.

HTML image source simple example. This is a needed img tag with src attribute and alt text description.

<img src=’flag.jpg’ alt=” image with nice flag “>

Alternate text for an image.

Any HTML web page’s pictures have alternate text information provided by the alt attribute.

You need this to access the embedded picture. Considering that this data is then shown. When a website cannot load an image for whatever reason, this image alt text information is read aloud, or by a screen reader for Internet users who are blind or visually challenged. html image source alt text simple example Image text should give a description of the picture or describe its function.

<img src=’laptop.jpg’ alt=’image of laptop’>

Picture size.

picture Width Attribute – According to your needs, you may define the width of the existing picture in image pixels on the active html web page.

You may modify the display size of photos on a web page using the HTML code provided below.

Simple example of an html image width.

<img src=’desktop.jpg’ alt=’image of desktop’ width=’500′>

Picture height.

There are numerous ways to specify the image’s height in pixels on an existing html web page using the image height element.

It gives you the same control over an image’s display size in an HTML web page as the image width property.

Simple example of html image height.

 <img src=’notebook.jpg’ alt=’notebook image’ height=’400′>

html code written above To alter how a picture displays on your website, utilize these image characteristics.

Simple example of html picture height and width.

<img src=’computer.gif’ alt=’nice image of computer background’ width=’500′ height=’400′>

The code provided here in the html web page renders a picture with a 500-pixel width and a 300-pixel height. Additionally, it offers access to picture alt text information for internet users. Adjust the width, height, and alt attributes of the picture to meet the unique image and design specifications of your existing html web page.

Html src, alt, width, and height Example.

<!DOCTYPE html>

<html>

<head>

    <title>Html Image Attributes Example</title>

</head>

<body>

    <h1>Image Attributes with width and height Example</h1>

    <!– Embedding an image with src, alt, width, and height attributes on internal offline source –>

    <img src=”racevideo.jpg” alt=”nice race video” width=”500″ height=”400″>

    <!– You can embedding an image with src, alt, width, and height attributes on external online source –>

    <p>Online Image source – <a href=”https://unsplash.com/photos/EhTcC9sYXsw”>Nice Macbook Image</a></p>

</body>

</html>

Embedding audio and video with <audio> and <video>

Using the <audio> and <video> file tags in your built HTML web pages, you can now embed audio and video multimedia file types or resources in HTML web pages. HTML 5 and later. You may play music and video files on your web pages by using these multimedia tags and components.

Here is how to include them in any html document.

using the <audio> element to embed an audio file in an HTML web page.

Insert basic audio html tags here.

<Audio Control>

     <source src=’song.mp3′ type=’audio/mpeg’>

     your web browser is too old, you need to update it.

</audio>

The <audio> element is used in the new HTML version to embed audio file content in any web page.

As a result, the audio file that is being added contains control properties that may control audio playback controls like play, pause, and volume, among other things. controls for an audio player.

To address concerns with browser compatibility, you can utilize one or more <source> tags/elements inside the html <audio> tag to indicate various audio formats. In the previous example, we used an existing web page to incorporate the source of an MP3 file as an audio file format.

HTML alternate text for audio.

<Audio Control>

     <source src=’alarm.mp3′ type=’audio/mpeg’>

     your web browser is too old, you need to update it.

     <p>this audio file play simple alarm audio sound</p>

</audio>

On your website, you can include alternative text information material inside the <audio> tag element. This will be shown if the current audio tag source is incompatible with your web browser or it is outdated.

Html audio embedded example.

<!DOCTYPE html>

<html>

<head>

    <title>HTML Audio Tag Example</title>

</head>

<body>

    <h1>Let’s Try some html audio example</h1>

    <!– Embedding an audio file from internal local hard drive sources–>

    <audio controls>

        <source src=”song.mp3″ type=”audio/mpeg”>

        your web browser is too old, you need to update it.

    </audio>

    <!– Embedding an audio file from external internet sources–>

    <p>Let’s play online Audio file – <a href=”https://www.bensound.com/royalty-free-music/track/stories-of-time-hopeful-synth”>Stories of time sound</a></p>

</body>

</html>

Embedding Video with <video>.

Simple HTML video tag illustration.

If you wish to add a movie or other multimedia object to an already-existing website or web page. Therefore, you must use a video tag or element that is compatible with HTML 5.

<video controls>

   <source src=”videoname.mp4″ type=”video/mp4″>

     your web browser is too old, you need to update it.

</video>

You may include video file types and other multimedia material into an already-existing web page by using the HTML <video> tag.

The play video control now has the control property video playback thanks to the video tag.

You can use one or more <source> elements inside the <video> tag to specify various video formats for the web browsers that are installed on your machine. The source in the example above may be an MP4 file or a video in the mpeg, flv, etc. formats.

HTML alternative text for a video.

<video controls>

   <source src=”videoname.mp4″ type=”video/mp4″>

   Your browser does not support the video element.

   <p>Alternative text for video</p>

</video>

You may insert alternative video material inside the <video> element in your current html file, just like you can with the html audio tag. This only appears in a web browser if the web browser is unable to play the existing video file or format element.

Width and height properties for html videos.

In order to customize the dimensions of the video file’s default play video player on your website, you may also set the width and height video properties.

<video controls width=”640″ height=”360″>

   <source src=”videoname.mp4″ type=”video/mp4″>

   Your browser does not support the video element.

</video>

These examples show you how to utilize the audio and video elements in HTML documents to include audio and video file types and other multimedia material. You may adjust the audio and video settings on a website or in your web browser to suit your needs.

Embedding Video with <video> Example.

<!DOCTYPE html>

<html>

<head>

    <title>HTML Video tag Example</title>

</head>

<body>

    <h1>Basic HTML Video Tag Example</h1>

    <!– Embedding a internal local hard drive video file example–>

    <video controls width=”640″ height=”360″>

        <source src=”mountain.mp4″ type=”video/mp4″>

          Your browser is too old and does not support the video element.

    </video>

    <!– Embedding a external online hard drive video file example –>

    <p>Online Video file  source – <a href=”https://pixabay.com/videos/sound-music-melody-song-singing-5095/”>Multimedia video</a></p>

</body>

</html>

Rate this post

Leave a Comment

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

Scroll to Top