Describe the various HTML elements used for working with text, lists, tables, hyperlinks,
images, and multimedia. Provide examples for each and explain how attributes enhance
their functionality.
Answer:
HTML provides different elements to structure and display web content.
1. Working with Text
Headings: <h1> to <h6>
Paragraphs: <p>
Bold/Italic: <b>, <i>, <strong>, <em>
Example:
<h2>Introduction</h2>
<p>This is a sample paragraph.</p>
2. Working with Lists
Ordered List: <ol>
Unordered List: <ul>
Definition List: <dl>, <dt>, <dd>
Example:
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
3. Working with Tables
Uses <table>, <tr>, <th>, <td>
Example:
<table border="1">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>John</td><td>20</td></tr>
</table>
4. Working with Hyperlinks
Uses the anchor tag <a>
Attributes: href, target
Example:
<a href="[Link] target="_blank">Visit</a>
5. Working with Images
Uses <img>
Attributes: src, alt, width, height
Example:
<img src="[Link]" alt="My Photo" width="200">
6. Multimedia
Audio: <audio controls>
Video: <video controls>
Example:
<video src="movie.mp4" controls></video>
Role of Attributes
Attributes modify the behavior of HTML elements:
href changes link destination.
alt gives alternate text for images.
controls adds buttons to audio/video.
border, width, height adjust table and image appearance.
Attributes improve usability and user experience.
Explain the basic structure of an HTML document with a neat diagram. Discuss the
purpose of each section (<!DOCTYPE>, <html>, <head>, <title>, <body>). Also describe
how HTML documents are created and rendered in browsers.
Answer:
An HTML document follows a standard structure so that browsers can interpret and display
the content correctly. The basic structure consists of the following components:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
Content goes here
</body>
</html>
Explanation of Each Section:
1. <!DOCTYPE html>
o Declares the document type and HTML version.
o Helps the browser render the page in standard mode.
2. <html>
o Root element of the HTML document.
o Encloses all other tags except <!DOCTYPE>.
3. <head>
o Contains metadata like title, keywords, scripts, CSS, and character set.
o Not visible on the webpage.
4. <title>
o Defines the title shown on the browser tab.
o Useful for SEO and bookmarking.
5. <body>
o Contains all the visible content such as headings, paragraphs, images, tables,
forms, etc.
o Everything inside <body> is displayed on the webpage.
Creating and Rendering HTML Documents:
HTML documents are created using simple text editors like Notepad, VS Code, etc.
The file is saved with a .html extension.
When opened in a browser, the browser’s HTML parser reads the tags and displays
the formatted content.
5mark
Describe the various HTML elements used for working with text, lists, tables, hyperlinks,
images, and multimedia. Provide examples for each and explain how attributes enhance
their functionality.
Answer:
HTML provides different elements to structure and display web content.
1. Working with Text
Headings: <h1> to <h6>
Paragraphs: <p>
Bold/Italic: <b>, <i>, <strong>, <em>
Example:
<h2>Introduction</h2>
<p>This is a sample paragraph.</p>
2. Working with Lists
Ordered List: <ol>
Unordered List: <ul>
Definition List: <dl>, <dt>, <dd>
Example:
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
3. Working with Tables
Uses <table>, <tr>, <th>, <td>
Example:
<table border="1">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>John</td><td>20</td></tr>
</table>
4. Working with Hyperlinks
Uses the anchor tag <a>
Attributes: href, target
Example:
<a href="[Link] target="_blank">Visit</a>
5. Working with Images
Uses <img>
Attributes: src, alt, width, height
Example:
<img src="[Link]" alt="My Photo" width="200">
6. Multimedia
Audio: <audio controls>
Video: <video controls>
Example:
<video src="movie.mp4" controls></video>
Role of Attributes
Attributes modify the behavior of HTML elements:
href changes link destination.
alt gives alternate text for images.
controls adds buttons to audio/video.
border, width, height adjust table and image appearance.
Attributes improve usability and user experience.
What are HTML markup tags? Explain heading tags, paragraph tags, and line break tags
with examples.
Answer:
HTML markup tags define the structure and presentation of content.
1. Heading Tags (<h1>–<h6>)
o Represent different levels of headings.
o <h1> is the largest and <h6> is the smallest.
Example:
<h1>Main Title</h1>
2. Paragraph Tag (<p>)
o Used to write paragraphs of text.
o Automatically adds space before and after the paragraph.
Example:
<p>This is a paragraph.</p>
3. Line Break Tag (<br>)
o Inserts a new line without starting a new paragraph.
Example:
Line 1<br>Line 2
5M – Question 2
Describe the different types of lists in HTML with examples.
Answer:
HTML supports three main types of lists:
1. Ordered List (<ol>)
o Items are numbered.
2. <ol>
3. <li>Step 1</li>
4. <li>Step 2</li>
5. </ol>
6. Unordered List (<ul>)
o Items are marked with bullets.
7. <ul>
8. <li>Red</li>
9. <li>Blue</li>
10. </ul>
11. Definition List (<dl>)
o Suitable for terms and definitions.
12. <dl>
13. <dt>HTML</dt>
14. <dd>HyperText Markup Language</dd>
15. </dl>
5M – Question 3
Explain how hyperlinks and images are added to an HTML document. Write syntax for <a>
and <img> tags.
Answer:
1. Hyperlinks
Created using <a> tag.
The href attribute specifies the URL.
Syntax:
<a href="url">link text</a>
Example:
<a href="[Link]
2. Images
Inserted using <img> tag (self-closing).
The src attribute holds the path of the image.
alt describes the image for accessibility.
Syntax:
<img src="[Link]" alt="description">
Example:
<img src="[Link]" alt="Flower Image" width="200">