Course Content
Project file
0/1
Complete Web Designing Course for Beginners

Images & Multimedia in HTML

🎨 Adding Images, Audio, and Videos to Make Websites Attractive


🎯 Learning Objectives

After completing this lesson, students will be able to:

βœ… Add images to webpages

βœ… Understand image formats

βœ… Use the <img> tag

βœ… Resize images

βœ… Add alternative text

βœ… Insert audio files

βœ… Insert video files

βœ… Create attractive multimedia webpages

βœ… Understand best practices for media usage


πŸ“– Introduction

Imagine opening a website that contains only text.

Example:

Β 
Welcome to Our College

We provide quality education.

Contact us for admission.
Β 

The website works, but it looks boring.

Now imagine:

βœ… College Logo

βœ… Campus Photos

βœ… Videos

βœ… Audio Messages

The website becomes more attractive and professional.

This is where:

πŸ–ΌοΈ Images & Multimedia

play an important role.


🌍 What is Multimedia?

Multimedia means combining different forms of content.

Examples:

Text

Images

Audio

Video

Animation

Modern websites use multimedia to improve user experience.


πŸ–ΌοΈ What is an Image?

An image is a visual representation displayed on a webpage.

Examples:

  • College Logo
  • Student Photo
  • Product Image
  • Company Banner
  • Profile Picture

🎯 Why Use Images?

Images help:

βœ… Improve appearance

βœ… Explain concepts visually

βœ… Increase user engagement

βœ… Make websites professional


🌟 HTML Image Tag

Images are added using:

<img>

This tag is called:

Image Tag


Basic Syntax

<img src="image.jpg">

Understanding the Syntax

img

Image Tag


src

Source

Specifies image location.


Example

<img src="college.jpg">

How It Works

Browser looks for:

college.jpg

and displays the image.


πŸ–₯️ Example Project Structure

Β 
Project

β”‚

β”œβ”€β”€ index.html

β”œβ”€β”€ college.jpg
Β 

HTML Code

<img src="college.jpg">

Browser displays the image.


πŸ“ Setting Image Width

We can control image size.

Example:

<img src="college.jpg" width="300">

Result

Image width becomes:

Β 
300 pixels
Β 

πŸ“ Setting Height

Example:

<img src="college.jpg" height="200">

Setting Both Width and Height

<img src="college.jpg"
width="300"
height="200">

🎯 Real Life Example

<img src="student.jpg"
width="250"
height="250">

Useful for profile pictures.


πŸ“ Alternative Text (ALT)

One of the most important image attributes.

Syntax:

<img src="college.jpg"
alt="College Building">

What is ALT?

ALT stands for:

Alternative Text


Why Is ALT Important?

Suppose:

❌ Image fails to load

Browser displays:

Β 
College Building
Β 

instead.


Benefits of ALT

βœ… Accessibility

βœ… Better SEO

βœ… User Understanding


Professional Example

<img src="logo.png"
alt="NextGen Dev Hub Logo">

Always use ALT text.


πŸ’» Complete Image Example

<!DOCTYPE html>

<html>

<head>

<title>Images Example</title>

</head>

<body>

<h1>College Campus</h1>

<img src="college.jpg"
alt="College Campus"
width="500">

</body>

</html>

πŸ–ΌοΈ Supported Image Formats

Common image formats:

JPG / JPEG

Most common.

Good for photographs.


PNG

Supports transparency.

Good for logos.


GIF

Supports animations.


WEBP

Modern optimized format.

Smaller file size.


🎯 Recommended Formats

Use Case Format
Photos JPG
Logos PNG
Animations GIF
Modern Websites WEBP

πŸ”— Making Images Clickable

Images can also act as hyperlinks.

Example:

<a href="https://www.google.com">

<img src="google.png"
width="200">

</a>

Result

Clicking image opens Google.


🎡 Adding Audio

HTML allows audio playback.

Tag:

<audio>

Basic Syntax

<audio controls>

<source src="music.mp3">

</audio>

Understanding

controls

Displays:

  • Play Button
  • Pause Button
  • Volume Control

Example

<audio controls>

<source src="song.mp3">

</audio>

Output

Browser displays an audio player.


πŸŽ₯ Adding Videos

HTML also supports videos.

Tag:

<video>

Basic Syntax

<video controls width="500">

<source src="video.mp4">

</video>

Example

<video controls width="500">

<source src="college-tour.mp4">

</video>

Result

Browser displays video player.


🎯 Video Controls

Using:

Β 
controls
Β 

provides:

βœ… Play Button

βœ… Pause Button

βœ… Volume Control

βœ… Full Screen Option


πŸ“ Video Size

Example:

<video controls
width="600">

Sets video width.


🌟 Complete Multimedia Example

<!DOCTYPE html>

<html>

<head>

<title>Multimedia Example</title>

</head>

<body>

<h1>Welcome to Our College</h1>

<img src="college.jpg"
width="500"
alt="College Campus">

<br><br>

<audio controls>

<source src="welcome.mp3">

</audio>

<br><br>

<video controls width="500">

<source src="college-tour.mp4">

</video>

</body>

</html>

πŸ—οΈ Professional Folder Structure

Β 
Project

β”‚

β”œβ”€β”€ index.html

β”‚

β”œβ”€β”€ images

β”‚ β”œβ”€β”€ logo.png

β”‚ β”œβ”€β”€ campus.jpg

β”‚

β”œβ”€β”€ audio

β”‚ └── welcome.mp3

β”‚

└── video

└── tour.mp4
Β 

Using Folder Paths

Image:

<img src="images/logo.png">

Audio:

<audio controls>

<source src="audio/welcome.mp3">

</audio>

Video:

<video controls>

<source src="video/tour.mp4">

</video>

⚠️ Common Beginner Mistakes


Mistake 1

Wrong File Name

Wrong:

<img src="logoo.png">

Correct:

<img src="logo.png">

Mistake 2

Missing ALT Text

Wrong:

<img src="logo.png">

Correct:

<img src="logo.png"
alt="Company Logo">

Mistake 3

Large Image Files

Huge images slow websites.

Always optimize images.


Mistake 4

Incorrect Folder Path

Wrong:

<img src="logo.png">

when image is inside:

images/logo.png

Correct:

<img src="images/logo.png">

🌟 Best Practices

βœ… Always use ALT text.

βœ… Use appropriate image formats.

βœ… Resize large images.

βœ… Organize files into folders.

βœ… Use descriptive file names.

βœ… Compress large images.


πŸ† Mini Project – Student Profile Page

<!DOCTYPE html>

<html>

<head>

<title>Student Profile</title>

</head>

<body>

<h1>My Profile</h1>

<img src="student.jpg"
alt="Student Photo"
width="250">

<p>Name: Rahul Kumar</p>

<p>Branch: Computer Science</p>

</body>

</html>

πŸ“ Practical Activity

Create a webpage containing:

Your Photo

College Logo

One Audio File

One Video File

Display everything properly.

Run it in Chrome.


πŸ“‹ Assignment

Assignment 1.7

Answer the following:

  1. What is multimedia?
  2. Which tag is used to display images?
  3. What is the purpose of the src attribute?
  4. What is ALT text?
  5. Which tag is used for audio?
  6. Which tag is used for video?
  7. Create HTML code displaying an image.

🧠 Quiz

Q1. Which tag displays an image?

A. <image>

B. <img>

C. <picture>

D. <photo>

βœ… Answer: B


Q2. Which attribute specifies image location?

A. href

B. src

C. alt

D. target

βœ… Answer: B


Q3. What does ALT provide?

A. Image Size

B. Alternative Text

C. Audio Control

D. Video Source

βœ… Answer: B


Q4. Which tag plays audio?

A. <music>

B. <sound>

C. <audio>

D. <mp3>

βœ… Answer: C


Q5. Which tag displays video?

A. <movie>

B. <media>

C. <video>

D. <screen>

βœ… Answer: C


πŸ“Œ Lesson Summary

βœ… Images make websites attractive and engaging.

βœ… HTML uses the <img> tag to display images.

βœ… The src attribute specifies image location.

βœ… ALT text improves accessibility and SEO.

βœ… HTML supports audio using the <audio> tag.

βœ… HTML supports video using the <video> tag.

βœ… Multimedia improves user experience.

βœ… Proper file organization is important for professional projects.

Scroll to Top