Chapter 2
Chapter 2
a. Container Tags
b. Empty (Self-closing) Tags
b. Specifying Keywords :
Helps in search engine indexing (though not heavily used
now).
a. <title>
b. <meta>
c. <link>
e. <script>
<b>
Makes the text bold (used for styling, no <b>Hello</b>
Hello
extra importance)
Tag Functionality Example Output
<strong>
Makes the text bold and gives strong <strong>Warning!</strong>
Warning!
importance
<i> Makes the text italic (used for styling) <i>Italic text</i> Italic text
<em>
Emphasizes the text (usually italic with <em>Important</em>
Important
semantic meaning)
<u> Underlines the text <u>Underlined</u> Underlined
<mark>
Highlights the text with a yellow <mark>Highlight</mark>
Highlight
background
Tag Purpose
<th> (Table Header) Defines a header cell (bold and centered by default).
Code
<html>
<head>
<title>Student Table</title>
</head>
<body>
<h2>Student Information</h2>
<table border =”black”>
<tr>
<th>Name</th>
<th>Student ID</th>
<th>Address</th>
<th>Specialization</th>
</tr>
<tr>
<td>Aryan Roy</td>
<td>ST101</td>
<td>Kolkata</td>
<td>Computer Science</td>
</tr>
<tr>
<td>Priya Das</td>
<td>ST102</td>
<td>Delhi</td>
<td>Information Technology</td>
</tr>
<tr>
<td>Ravi Kumar</td>
<td>ST103</td>
<td>Mumbai</td>
<td>Artificial Intelligence</td>
</tr>
<tr>
<td>Meena Verma</td>
<td>ST104</td>
<td>Chennai</td>
<td>Data Science</td>
</tr>
</table>
</body>
</html>
Output
20. What is the functionalities of border, rowspan, colspan,
cellspacing and cellpadding attribute .
Tag
Attribute Functionality Example Effect
Used In
Displays a
Sets the thickness of
border around
border <table> the border around the <table border="1">
the table and
table and its cells.
each cell.
<td>, Merges a cell vertically <td The cell spans
rowspan
<th> across multiple rows. rowspan="2">Text</td> 2 rows.
Merges a cell
<td>, <td The cell spans
colspan horizontally across
<th> colspan="3">Text</td> 3 columns.
multiple columns.
Sets the spacing
Adds 5px
between individual
cellspacing <table> <table cellspacing="5"> space between
table cells (outside the
table cells.
cell borders).
Sets the spacing
Adds 10px
between cell content <table
cellpadding <table> padding inside
and the cell border cellpadding="10">
each cell.
(inside the cell).
b. Element
An element includes both the opening tag, the content inside,
and the closing tag. It represents the complete structure.
Here, <p> is the opening tag, </p> is the closing tag, and
everything together is the element.
c. Attribute
An attribute provides additional information about an HTML
element. It is always written inside the opening tag .
d. Attribute Value
Tag
Displ
List (s) Purpos Output
ay Example Code
Type Use e Example
Style
d
To
display
items
<o Numb
in a
Ordere l>, ered html<br><ol><li>One</li><li> 1. One2.
specifi
d List <l (1, 2, Two</li></ol> Two
c,
i> 3...)
number
ed
order
To
display
<u items
Unord Bullet
l>, without html<br><ul><li>Apple</li><l • Apple•
ered ed (•,
<l any i>Mango</li></ul> Mango
List ○)
i> particul
ar
order
<d To
define Term
l>, HTML
Descri terms follow
<d html<br><dl><dt>HTML</dt><dd Markup
ption and ed by
t>, >Markup Language</dd></dl> Languag
List their definit
<d e
descrip ion
d>
tions
23. How ordered and unordered lists can be formatted.
Explain with example .
🧾 Example:
<ol type="A">
<li>Physics</li>
<li>Chemistry</li>
<li>Biology</li>
</ol>
Output :
A. Physics
B. Chemistry
C. Biology
b. Formatting Unordered Lists (<ul>)
<ul type="square">
<li>Apple</li>
<li>Banana</li>
<li>Grapes</li>
</ul>
Output:
■Apple
■Banana
■ Grapes
24. What are the various types of html form elements are
there. Design a new user registration form using all
available options .
<html>
<head>
<style>
label {
display: block;
width: 300px;
padding: 8px;
</style>
</head>
<body>
<label>Full Name:</label>
<input type="text" name="fullname" required>
<label>Email:</label>
<label>Password:</label>
<label>Age:</label>
<label>Gender:</label>
<label>Skills:</label>
<select name="country">
<option value="india">India</option>
<option value="usa">USA</option>
<option value="uk">UK</option>
</select>
<label>Bio:</label>
<label>Date of Birth:</label>
<br><br>
</body>
</html>
25. What are the functionalities of html frames, frameset
tag explain with a simple example.
Tag Description
<frameset> Replaces the <body> tag and divides the page into frames
Example
<h2>Example of an Embedded Web Page</h2>
Self-contained
html <article><h2>News</h2><p>New
<article> content (blog post,
course launched!</p></article>
news, etc.).
Content related to
main content html <aside><h3>Tips</h3><p>Use
<aside>
(sidebar, ads, semantic tags!</p></aside>
related links).
Embeds audio html <audio controls><source
<audio> (music, sound) with src="song.mp3"
controls. type="audio/mpeg"></audio>
html <video controls
Embeds video with
<video> width="320"><source src="video.mp4"
playback controls.
type="video/mp4"></video>
📸 Visual Output:
Code
<table border="1">
<tr>
<th>Roll No</th>
<th>Name</th>
<th>Marks</th>
</tr>
<tr>
<td>1</td>
<td>Raj</td>
<td>85</td>
</tr>
<tr>
<td>2</td>
<td>Priya</td>
<td>90</td>
</tr>
<tr>
<td>3</td>
<td>Sameer</td>
<td>78</td>
</tr>
</table>
32. What is the full form of bom and com. Explain each
type .
Web Browsers
BOM Browser Object Model Lets JavaScript control browser functions
(JavaScript)