Warning Disclaimer Notice:
The below answers and discussions are directly prepared by copy-paste from www.google.com, Googole AI Overview, https://gemini.google.com/app , https://chatgpt.com/,etc,
These are only for understanding to improve the concept only; not for answers. We have not checked these clearly. Some mistakes may be happened. We are not responsible for any wrong information and answers. Please check yourself, yourselves and discuss with your expert teachers for the final approval or accepted the answers.
PART - I Introduction
Exercise
I. FILL IN THE BLANKS:
1. ______________ documents are made up of text content and
special codes.
2. ______________ are used to write notes about an HTML document.
3. HTML document is saved with an extension ____________
4. ___________ are used to view the HTML documents.
5. The __________ element include both on and off tags.
6. The ___________ element splits the line and displays the text
on a new line.
Answer:
1.
HTML documents
are made up of text content and special codes (tags).
2.
Comments (using <!-- -->) are used to write notes about an HTML document.
3.
HTML document is saved
with an extension .html or .htm.
4.
Web
browsers (like Chrome,
Firefox) are used to view the HTML documents.
5.
The element (like <p>...</p>) includes both on (start) and off (end) tags.
6.
The <br> (break) element splits the line and displays the
text on a new line.
II. MULTIPLE CHOICE QUESTIONS:
1. Which is the
correct way to comment out something in HTML?
i. Using ## and #
ii. Using <!-- and
-->
iii. Using </--
and -/->
iv. Using <!-- and -!>
Answer:
The correct way to
comment out something in HTML is using <!-- and --> [1]. This is
option ii.
Here is an example:
html
<!-- This is a
comment. It is not displayed in the browser. -->
2. The ___________ tag draws a
horizontal line across the web page.
i. <br> ii. <hr> iii.
<line>
Answer:
The correct tag
is ii. <hr>,
which stands for "horizontal rule" and draws a horizontal line across
a webpage, unlike <br> (line break)
or <line> (which isn't a standard HTML tag for
this purpose).
·
<hr>:
Draws a horizontal line (horizontal rule) to separate content.
·
<br>:
Inserts a single line break, moving text to the next line.
3. ______________ provides a set
of style rules for defining the layout of the HTML
documents.
i. CSS ii. WSS iii. TSS
Answer:
i. CSS (Cascading
Style Sheets) provides a set of style rules for defining the layout
of HTML documents.
4. A property and its value are
collectively known as ____________
i.
Selector ii. Attribute iii. Declaration
Answer:
(iii)
Declaration
A property and its
value, like color:
blue, are collectively
known as a declaration in CSS, which specifies styling;
the property is the characteristic (e.g., color) and the value is the setting (e.g., blue), forming a key-value pair often called
a property-value pair, though "Declaration" fits the
options best in a styling context.
·
Declaration: In CSS, property: value; (e.g., font-size: 16px;) is a complete declaration.
·
Attribute: In HTML, attributes provide extra
information about elements (e.g., <img src="image.jpg">), often containing property-value pairs.
·
Selector: This targets the HTML element to which
the declaration is applied (e.g., p in p { color: red; }).
5.
Which tag indicates the beginning and end of the HTML documents?
i.
<HEAD> ii. <BODY> iii. <HTML>
Answer:
The correct option
is ✅ iii. <HTML>.
The <html> tag acts as the container for all other
HTML elements and explicitly tells the web browser where the HTML-formatted
document begins and ends.
Explanation
·
The <html> element is known as the root
element of a web page.
·
Every HTML document
begins with the start tag <html> and
finishes with the closing tag </html>.
·
All other structural
elements, such as the head and the body, must be nested inside these
tags.
Why other options are incorrect
·
❌ <HEAD>: This tag indicates the beginning of
the header section, which contains metadata, titles, and links to
scripts or stylesheets. It does not encompass the entire document.
·
❌ <BODY>: This tag defines the beginning and end of
the visible content of the web page (such as text, images, and
links) rather than the entire HTML document itself.
6. Which of the following is used
to define the style for a single HTML page?
i.
Inline CSS ii. Internal CSS iii. External CSS
Answer:
The correct option is
✅ ii. Internal CSS.
Explanation
Internal CSS (also
known as embedded CSS) is specifically used to define styles for a single
HTML page. It is placed within the <style> tag inside the <head> section of an HTML document. This method is ideal when one
individual page needs a unique look that does not apply to the rest of the
website.
Why other options are incorrect
·
❌ i. Inline
CSS: This method is used to apply a unique style to a single HTML
element rather than an entire page. It uses the style attribute directly within the HTML tag.
·
❌ iii.
External CSS: This method is used to define styles for many HTML
pages or an entire website. It involves linking a separate .css file to multiple HTML documents using
the <link> tag.
III. APPLICATION BASED QUESTIONS:
1. Yashvi was styling
an HTML document using CSS. She wants to add styles directly to an HTML tag
using the style attribute with the tag. How can she do this?
Answer:
Yashvi can add styles
directly to an HTML tag using the style attribute by declaring CSS properties and values
within the tag itself. This is known as inline CSS [1].
The syntax is:
html
<tagname
style="property: value; property: value;">
Content
</tagname>
For example, to change
the color and font size of a paragraph (<p> tag), she would write:
html
<p
style="color: blue; font-size: 16px;">
This is a blue paragraph with a font size of 16
pixels.
</p>
Key points to
remember:
·
Each declaration
(e.g., color:
blue;) consists of a
property and a value, separated by a colon (:).
·
Multiple declarations
are separated by a semicolon (;).
·
This method has the
highest priority and overrides styles defined in a <style> block or external stylesheets [1].
2. Rohan wants to
divide his web page into different sections so that the content is easily
readable. Which tag can he use for this? Which attributes can he use to define
some extra properties of this tag?
Answer:
Rohan can use the
HTML <div> tag to divide his web page into
different sections for improved readability.
HTML Tag for Sections
The <div> tag (short for "division") is
a block-level container used to group larger chunks of content. By using
multiple <div> elements, Rohan can structure his
content into distinct sections, such as a header, navigation bar, main content
area, and footer, making the page layout clearer and more manageable [1].
While <div> is still widely used, modern HTML5 also
introduced semantic tags like <section>, <article>, <header>, <footer>, and <nav>,
which provide more meaning to the content they contain and are often preferred
for better accessibility and search engine optimization [1].
Attributes for Extra Properties
Rohan can use the
following attributes with the <div> tag to define extra properties:
|
Attribute |
Description |
Example |
|
class |
Specifies one or more class names for an element, often used to apply specific styles defined in a CSS stylesheet [1]. |
<div class="main-content"> |
|
id |
Specifies a unique ID for an element. This is useful for targeting a specific section with CSS or JavaScript [1]. |
<div id="section-two"> |
|
style |
Specifies an inline CSS style for an element, directly changing its appearance without referring to an external stylesheet [1]. |
<div style="background-color: #f0f0f0;"> |
|
title |
Specifies extra information about the element. This text is typically shown as a tooltip when the user hovers over the element [1]. |
<div title="This is the main section"> |
By utilizing these tags and attributes, Rohan can create a well-organized and visually appealing web page structure.
3. Kirti wants to set
the image of a park as the background of her web page but she is unable to do
it. Which tag should she use to do so? Give the syntax.
Answer:
Kirti should use
the <body> tag with the background attribute in HTML for a simple solution,
or preferably use CSS with the background-image property for better control, applying it to the body element to set the park image as her
webpage's background. The HTML syntax is <body background="park.jpg">, while the CSS syntax (inside <style> or a .css file) is body {
background-image: url("park.jpg"); }, often with background-size: cover; and background-repeat: no-repeat; for full coverage.
HTML Method (Simple but less flexible)
·
Tag: <body>
·
Syntax: <body background="park.jpg"> (Replace
"park.jpg" with the actual file name/path).
CSS Method (Recommended for modern web)
This involves two
parts: your HTML file and a CSS style.
1.
In your HTML file (inside <head> or linked CSS
file):
html
<style>
body {
background-image: url("park.jpg");
/* Path to your park image */
background-size: cover; /* Makes image cover the whole page
*/
background-repeat: no-repeat; /* Prevents image from tiling */
background-position: center; /* Centers the image */
}
</style>
2.
Your HTML (just the <body> tag):
html
<body>
<!--
Your page content goes here -->
</body>
This CSS method
provides more control over how the background image appears, ensuring it scales
and positions correctly.
IV. ANSWER THE FOLLOWING:
1. What is a markup
language?
Answer:
A markup language
is a system for annotating text with tags or codes to define its
structure, presentation, and meaning, allowing computers to interpret and
display content like headings, paragraphs, lists, and links correctly,
with HTML (for
web pages) and XML (for
data) being popular examples. Unlike programming languages, markup languages
describe what content is (e.g., a heading) rather
than how to perform actions, using symbols
like <> to mark up text for specific
functions.
Key Characteristics:
·
Uses
Tags: Elements are
enclosed in tags, such as <h1> for a main
heading or <p> for a paragraph.
·
Provides
Structure: Organizes
content into logical parts (headings, lists, tables).
·
Separates
Content from Presentation: Defines
structure, while separate languages like CSS handle visual styling.
·
Human-Readable: Generally more readable than traditional
programming languages.
Common Examples:
·
HTML
(HyperText Markup Language): The foundation of web pages, defining structure and
elements.
·
XML
(eXtensible Markup Language): A more general-purpose language for structuring and
transporting data.
·
Markdown: A lightweight markup language for simple
text formatting, common in documentation and forums.
How it Works:
A web browser reads an
HTML document, interprets the tags (like <p>), and renders the text accordingly, displaying it as formatted
content rather than showing the tags themselves.
2. Write some feature
of HTML.
Answer:
HTML (HyperText Markup
Language) is the standard markup language for creating web pages and web
applications. Key features include its simplicity, platform
independence, and strong support for multimedia and hyperlinking.
Core Features of HTML
·
Simple
and Easy to Learn: HTML uses simple,
human-readable tags (e.g., <h1>, <p>, <a>) to define the structure and content of a web page, making it
beginner-friendly.
·
Platform
Independent: HTML documents can
be displayed on any device, operating system (Windows, macOS, Linux, etc.), or
web browser without requiring modifications.
·
Browser
Support: All major web
browsers (Chrome, Firefox, Safari, Edge) universally support HTML, ensuring
consistent display and functionality of web content across different platforms.
·
Hyperlinking: HTML's "Hypertext" feature allows
seamless navigation between different web pages and websites through the use of
hyperlinks, which is fundamental to the World Wide Web.
·
Multimedia
Support: Modern HTML (HTML5)
introduced dedicated tags like <audio>, <video>,
and <canvas> that allow developers to embed various
media types directly into web pages without the need for external plugins.
·
Semantic
Elements: HTML5 introduced new
semantic tags (e.g., <header>, <footer>, <article>, <section>)
that provide clearer structure and meaning to the content, which improves accessibility
and aids search engine optimization (SEO).
·
Integration
with Other Languages: HTML serves as the
structural foundation and easily integrates with other technologies like CSS
for styling and JavaScript for interactivity, enabling the creation of dynamic
and visually appealing websites.
·
Client-Side
Data Storage: HTML offers APIs
such as Local Storage and IndexedDB, enabling web applications to store data
locally on the user's device for improved performance and even offline
capabilities (Progressive Web Apps).
·
Case
Insensitive (Mostly): While best practice
is to use lowercase for consistency, the language itself is largely
case-insensitive for tags and attributes, which can simplify coding and reduce
errors.
·
Open
Standard and Free: HTML is an open
standard maintained by the World Wide Web Consortium (W3C) and is
completely free to use without requiring any licenses or software.
3. Explain the terms
tags and attributes with the help of an example.
Answer:
In HTML, tags are
keywords in angle brackets (like <a>) that define content structure (e.g., a link), while attributes provide
extra details about a tag (like href="url"), appearing in the opening tag as name="value" pairs to modify behavior or appearance,
such as specifying the destination of a link. For example, in <a
href="https://example.com">Visit Example</a>, <a> is the tag, href is the attribute name, and "https://example.com" is its value, making the text
"Visit Example" a clickable link to that URL.
·
Definition: Simple keywords enclosed in angle
brackets (<
>) that tell the
browser how to structure and display content.
·
Function: Mark the beginning and end of an element
(e.g., <p> for paragraph, <img> for image).
·
Example: <p> (start of paragraph), </p> (end of paragraph).
·
Definition: Properties that provide additional
information about an element or modify its function.
·
Function: Appear as name="value" pairs within the opening tag.
·
Example: In an image tag <img>, src (source) and alt (alternative text) are common attributes.
Example: Creating a Link
·
Code: <a href="https://www.google.com"
target="_blank">Search Google</a>.
·
Tag: <a> (defines an anchor or link).
·
Attributes:
o
href="https://www.google.com": Specifies the link's destination (URL).
o
target="_blank": Tells the browser to open the link in a new tab.
·
Content: "Search Google" (the clickable
text).
4. How are comments
useful? (in HTML and CSS3)
Answer:
Comments in HTML and
CSS3 are essential developer-readable annotations that are ignored by the
browser, meaning they do not affect the webpage's appearance or functionality.
Their primary utility lies in improving code readability,
maintainability, and collaboration for anyone working with the source
code.
Usefulness in HTML
HTML comments
(syntax: <!--
your comment here -->) help manage the
structure and content of a webpage.
·
Documentation
and Explanation: They allow
developers to leave notes, explanations, and context about specific HTML
elements or sections, especially for complex or non-obvious code.
·
Code
Organization: Comments can be used
as section headers to logically structure the code, making large documents
easier to navigate and understand (e.g., <!-- Navigation Bar --> or <!-- Footer Section -->).
·
Debugging
and Testing: Developers can
temporarily "comment out" sections of code to hide content or disable
functionality for troubleshooting purposes, without permanently deleting the
code.
·
Reminders
and Collaboration: They serve as
in-line communication tools for teams, including "to-do" lists or
notes about pending questions and future improvements.
Usefulness in CSS3
CSS comments
(syntax: /*
your comment here */) are used within
stylesheets to clarify styling rules and their application.
·
Explanation
of Styles: Comments provide
context for specific style choices, such as why a particular color or font was
chosen, which helps when revisiting the code later.
·
Organization
and Sectioning: Similar to HTML,
comments can be used to break up stylesheets into logical sections (e.g., /* Header styles */, /* Reset styles */), improving readability in large files.
·
Temporarily
Disabling Styles: Specific CSS rules
or blocks can be commented out during debugging or experimentation to see how
their removal affects the page layout.
·
Documenting
Design Decisions: They can document
specific workarounds or browser compatibility notes for non-standard
approaches, though modern techniques like feature detection are more common
now.
In both HTML and CSS,
comments are a vital practice for creating well-documented, maintainable, and
collaborative codebases.
5. What are Cascading
Style Sheets? Name the different methods available for applying Style rules in
an HTML document.
Answer:
Cascading Style Sheets
(CSS) is a style sheet language used for describing the presentation of a
document written in HTML or XML [1, 2]. CSS defines how elements should be
rendered on screen, on paper, or in other media, separating the content of a
webpage from its visual design [1, 2].
The different methods
available for applying style rules in an HTML document are:
·
External
Style Sheets This method
links an external .css file to the HTML
document using the <link> element
within the <head> section of the HTML. This is the most
common method as it allows one CSS file to control the design of an entire
website, making updates efficient [1, 2, 3].
·
Internal
Style Sheets Also known as
embedded styles, this method places the CSS rules directly within the <head> section of the HTML document, enclosed
within <style> tags [1, 2]. The rules apply only to
that specific page.
·
Inline
Styles This method
applies CSS rules directly to a single HTML element using the style attribute. These styles only affect the
specific element they are declared on and have the highest precedence,
overriding rules from internal and external styles [1, 2].
6. Differentiate between Internal CSS and External CSS.
Answer:
The main difference
between Internal CSS and External CSS is
their location and scope: Internal CSS is embedded within a single HTML
file and affects only that page, while External CSS is in a separate file and
can be linked to multiple HTML pages.
|
Feature |
Internal CSS |
External CSS |
|
Location |
Within a <style> tag in the <head> section
of an HTML document. |
In a separate file with a .css extension. |
|
Scope |
Styles a single HTML page only. |
Styles multiple HTML pages, an
entire website, or a section of it. |
|
Implementation |
No separate file needed; styles
are part of the HTML. |
Requires an additional HTTP
request to link the external file using a <link> tag. |
|
Maintainability |
Difficult to maintain across large
sites, as each page's styles must be updated individually. |
Highly maintainable; changing one
file updates the style across all linked pages. |
|
Performance |
Can increase HTML file size but
reduces HTTP requests for styles. |
Allows browsers to cache the CSS
file, potentially leading to faster page loads on subsequent visits. |
|
Best
For |
Single-page websites, rapid
prototyping, or when unique styles are needed for one specific page. |
Large, multi-page websites where a
consistent look and feel is essential. |
In most professional
web development, the external CSS method is the recommended approach for the
separation of concerns (keeping structure and presentation separate) and ease
of maintenance.
LAB ACTIVITY
1. Create a web page
that serves as an invitation card to your birthday party. Use all the HTML tags
along with CSS properties you have learnt to make it attractive and lively.
Answer:
<!DOCTYPE html>
<html lang="en">
<head>
<meta
charset="UTF-8">
<meta
name="viewport" content="width=device-width,
initial-scale=1.0">
<title>You're
Invited! A Birthday Celebration</title>
<!-- Link to external
CSS file (optional, but good practice) -->
<link
rel="stylesheet" href="styles.css">
<!-- Internal CSS for
styling -->
<style>
/* CSS Reset and
General Styles */
* {
box-sizing:
border-box;
margin: 0;
padding: 0;
}
body {
font-family:
'Georgia', serif;
background-color: #f0e6f6; /* Light purple background */
color: #333;
line-height:
1.6;
text-align:
center;
padding: 20px;
}
/* Main container
for the invitation card */
.invitation-container {
max-width:
600px;
margin: 40px
auto;
background-color: #ffffff; /* White card background */
border-radius: 15px;
box-shadow: 0
4px 15px rgba(0, 0, 0, 0.2);
padding: 30px;
border: 5px
solid #ff69b4; /* Pink border */
animation:
fadeIn 2s ease-out;
}
/* Keyframes for
simple fade-in animation */
@keyframes fadeIn {
from { opacity:
0; transform: scale(0.9); }
to { opacity: 1;
transform: scale(1); }
}
/* Header Styling */
header h1 {
font-size: 3em;
color: #8a2be2;
/* Blue violet color */
margin-bottom:
10px;
text-shadow: 1px
1px 2px rgba(0, 0, 0, 0.1);
}
header p {
font-style:
italic;
color: #555;
margin-bottom:
20px;
}
/* Main Content
Section */
.content section {
margin-bottom:
25px;
}
.content h2 {
color: #ff69b4;
/* Pink color */
border-bottom:
2px solid #f0e6f6;
padding-bottom:
5px;
margin-bottom:
15px;
}
/* Using lists for
details */
ul {
list-style-type:
none;
padding: 0;
}
ul li {
margin-bottom:
10px;
font-size:
1.1em;
color: #444;
}
ul li strong {
color: #8a2be2;
}
/* Adding an image
placeholder (use a real image URL if available) */
.party-image {
width: 100%;
max-width:
300px;
height: auto;
border-radius:
10px;
margin-top:
20px;
border: 3px
dashed #ff69b4;
display: block;
margin-left:
auto;
margin-right:
auto;
}
/* Footer and RSVP Button
*/
footer {
margin-top:
30px;
font-size:
0.9em;
color: #777;
}
.rsvp-button {
display:
inline-block;
background-color: #8a2be2;
color: white;
padding: 12px
25px;
text-decoration:
none;
border-radius:
50px;
margin-top:
15px;
font-weight:
bold;
transition:
background-color 0.3s ease;
box-shadow: 0
4px 6px rgba(0, 0, 0, 0.1);
}
.rsvp-button:hover {
background-color: #ff69b4;
transform:
translateY(-2px);
}
/* Responsive Design
(Basic Media Query) */
@media (max-width:
600px) {
.invitation-container
{
margin:
20px;
padding:
20px;
}
header h1 {
font-size:
2.2em;
}
}
</style>
</head>
<body>
<!-- Main Invitation
Card Container -->
<div
class="invitation-container">
<!-- Header
Section -->
<header>
<h1>You're
Invited to My Birthday!</h1>
<p>Come
celebrate a new chapter with friends and fun.</p>
</header>
<!-- Image
Placeholder (using a generic party icon here) -->
<img
src="https://picsum.photos" alt="Party celebration image"
class="party-image">
<!-- Replace the
above URL with an actual image URL or local file path -->
<!-- Main Content
-->
<main
class="content">
<section>
<h2>The Details</h2>
<!--
Unordered list for structured info -->
<ul>
<li><strong>Date:</strong> Saturday, February 14th,
2026</li>
<li><strong>Time:</strong>
7:00 PM onwards</li>
<li><strong>Location:</strong> The Party Palace, 123
Celebration Lane, Party Town</li>
</ul>
</section>
<section>
<h2>The
Theme</h2>
<p>Join us for a <strong>Masquerade Night</strong>!
Dress up, wear a mask, and get ready for a memorable evening of music, dancing,
and delicious food.</p>
</section>
<section>
<h2>Special Notes</h2>
<!--
Using a blockquote for emphasis -->
<blockquote>
<p><em>Vegetarian and vegan options will be available.
Please let us know of any dietary restrictions!</em></p>
</blockquote>
</section>
</main>
<!-- Footer
Section -->
<footer>
<!-- Link to
RSVP action -->
<a
href="mailto:rsvp@example.com?subject=RSVP%20for%20Birthday%20Party"
class="rsvp-button">RSVP by Feb 7th!</a>
<p><small>Hosted by: [Your Name]</small></p>
</footer>
</div>
</body>
</html>
2. Create a web page
that serves as a guide for the mathematical formulas using HTML tags along with
CSS properties.
Answer:
<!DOCTYPE html>
<html lang="en">
<head>
<meta
charset="UTF-8">
<meta
name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Mathematical Formulas Guide</title>
<style>
body {
font-family:
'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height:
1.6;
margin: 0;
padding: 0;
background-color: #f4f4f4;
color: #333;
}
.container {
width: 80%;
margin: 20px
auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0
10px rgba(0,0,0,0.1);
}
header {
text-align:
center;
border-bottom:
2px solid #007bff;
padding-bottom:
10px;
}
h1 {
color: #007bff;
}
section {
margin-top:
20px;
}
h2 {
color: #0056b3;
border-left: 4px
solid #007bff;
padding-left:
10px;
background-color: #e9ecef;
padding: 5px
10px;
margin-top:
15px;
}
.formula-box {
background-color: #fafafa;
padding: 15px;
border: 1px
solid #ddd;
margin-bottom:
15px;
border-radius:
5px;
}
.formula-box p {
font-size:
1.1em;
margin: 0;
padding: 0;
}
/* Using HTML
entities and semantic tags for representation */
.math {
font-family:
serif; /* Serifs often render mathematical symbols better */
font-style:
italic;
font-size:
1.2em;
color: #d9534f;
}
.symbol {
font-style:
normal; /* ensures symbols like π don't italicize */
}
.exponent {
vertical-align:
super;
font-size:
0.8em;
}
.subscript {
vertical-align:
sub;
font-size:
0.8em;
}
footer {
text-align:
center;
margin-top:
40px;
padding-top:
20px;
border-top: 1px
solid #ddd;
font-size:
0.9em;
color: #666;
}
</style>
</head>
<body>
<div
class="container">
<header>
<h1>Guide
to Essential Mathematical Formulas</h1>
<p>A
simple reference guide using HTML and CSS for basic mathematical
notation.</p>
</header>
<main>
<section>
<h2>Algebra</h2>
<div
class="formula-box">
<p><strong>Quadratic Formula:</strong></p>
<p
class="math">
<var>x</var> =
−<var>b</var> ±
√(<var>b</var><span class="exponent">2</span>
− 4<var>ac</var>) / 2<var>a</var>
</p>
</div>
<div
class="formula-box">
<p><strong>Pythagorean Theorem:</strong></p>
<p
class="math">
<var>a</var><span
class="exponent">2</span> + <var>b</var><span
class="exponent">2</span> = <var>c</var><span
class="exponent">2</span>
</p>
</div>
</section>
<section>
<h2>Geometry</h2>
<div
class="formula-box">
<p><strong>Area of a Circle:</strong></p>
<p
class="math">
<var>A</var> = <span
class="symbol">π</span><var>r</var><span
class="exponent">2</span>
</p>
</div>
<div
class="formula-box">
<p><strong>Circumference of a
Circle:</strong></p>
<p
class="math">
<var>C</var> = 2 ×
<span class="symbol">π</span> ×
<var>r</var>
</p>
</div>
</section>
<section>
<h2>Calculus</h2>
<div
class="formula-box">
<p><strong>Basic Derivative:</strong></p>
<p
class="math">
d/<var>dx</var> (<var>x</var><span
class="exponent">n</span>) =
<var>n</var><var>x</var><span class="exponent">n</span>−1
</p>
</div>
<div
class="formula-box">
<p><strong>Integral of 1/x:</strong></p>
<p
class="math">
∫ (1/<var>x</var>) d<var>x</var> = ln(<var>x</var>)
+ <var>C</var>
</p>
</div>
</section>
</main>
<footer>
<p>For
more complex mathematical notation, consider using dedicated libraries like
[MathJax](https://www.mathjax.org) or [KaTeX](https://katex.org).</p>
<p>© 2026 Mathematical Formulas Guide</p>
</footer>
</div>
</body>
</html>
PART - II List, Tables And Images
Exercise
I. FILL IN THE BLANKS:
1.
By default, the unordered lists items are marked with ________________.
2.
____________________ attribute of list lets you reverse the order of the item
list.
3.
A list inside another list is called as a __________________ list.
4.
A collection of related elements is called as ______________.
5.
__________________ property of table defines the space between the content of
the
table and the border
6.
The <img> tag is an _________ tag, that means it has no closing tag.
7.
___________ is an attribute of the <img> tag which specifies the location
or URL of the image to be displayed.
8.
______ attribute is used to give border to an image.
Answer:
1.
By default, the
unordered lists items are marked with discs (or solid
circles).
2.
The reversed attribute of a list lets you reverse the
order of the item list.
3.
A list inside another
list is called as a nested list.
4.
A collection of
related elements is called as an array (in programming
context) or simply a list (in an HTML context).
5.
The padding (specifically padding in CSS, or the deprecated cellpadding attribute in HTML) property of a table
defines the space between the content of the table and the border.
6.
The <img> tag is an empty (or
void) tag, which means it has no closing tag.
7.
src is an attribute
of the <img> tag which specifies the location or URL
of the image to be displayed.
8.
border attribute is
used to give border to an image (note: this HTML attribute is deprecated; CSS
should be used instead).
II. MULTIPLE CHOICE QUESTIONS:
1. Which tag is used
for List items?
a. <OL> b.
<LI> c. <UL> d. <DL>
Answer:
The correct option
is ✅ b. <LI>.
Explanation
The <li> tag stands for List Item and
is the specific element used to define individual items within a list. While
other tags define the type of list being created, the <li> tag is required to actually input the
data points or items into those lists.
Why other options are incorrect
·
❌ a.
<OL>: This tag stands for Ordered List. It is a container
used to define the start and end of a numbered or sequential list, but it does
not represent the individual items themselves.
·
❌ c.
<UL>: This tag stands for Unordered List. It is used to
define the start and end of a bulleted list where the order does not matter.
·
❌ d.
<DL>: This tag stands for Description List (or
Definition List). It is used to group terms (<dt>) and their descriptions (<dd>), but it does not use the standard <li> tag for its content.
2. Which element
contains definition?
a. <DL> b.
<DD> c. <DT> d. <UL>
Answer:
The correct option is
✅ b. <DD>.
Explanation
The <DD> element (Definition Description or
Description Details) is used to contain the actual definition or description of
a term in a description list. It is always used within a <DL> container and typically follows a <DT> element.
Why other options are incorrect
·
❌ a.
<DL>: This stands for Definition List (or
Description List). It is the wrapper or container element that holds the entire
list structure but does not contain the individual definition text itself.
·
❌ c.
<DT>: This stands for Definition Term (or
Description Term). It is used to specify the word or phrase that is being
defined, not the definition itself.
·
❌ d.
<UL>: This stands for Unordered List. It is used to
create bulleted lists and does not have a native "definition"
component like description lists do.
3. Which of the
following can’t be the value of list-style-type?
a. Square b. Circle
c. Ellipse d. Disc
Answer:
The correct option is
✅ c. Ellipse.
Explanation
In CSS and HTML,
the list-style-type property defines the design of the list
item marker (bullet). Valid keywords for unordered lists include:
·
Square: Displays a solid square bullet.
·
Circle: Displays a hollow circle bullet.
·
Disc: The default value, which displays a solid
(filled) circle bullet.
Ellipse is not a valid predefined keyword for
this property and will not render a specific bullet style.
Why other options are incorrect
·
❌ Square:
This is a valid value used to create square markers for list
items.
·
❌ Circle:
This is a valid value used to create hollow circle markers.
·
❌ Disc:
This is a valid and often default value used to create solid
circle markers.
4. Which attribute is
only used with <ol>?
a. Value b. type c. compact d. start
Answer:
The correct option is
✅ d. start.
Explanation
The start attribute
is exclusive to the <ol> (ordered list)
element. It defines the initial numerical value from which the list items
should begin counting. Because unordered lists (<ul>) do not use numerical or sequential markers, this attribute has
no function for them.
Why other options are incorrect
·
❌ a. Value:
While related to numbering, the value attribute is used on individual <li> (list item) elements rather than
the <ol> tag itself to manually change the
sequence at a specific point.
·
❌ b. type:
This attribute is not exclusive to <ol>. It is also used with <ul> (to define bullet styles like disc or square), <a> (to specify link MIME types), and <input> (to define the input field type).
·
❌ c. compact:
This is a legacy attribute that was used with both <ol> and <ul> (as well as <dir> and <menu>)
to suggest a smaller display style. It is now considered obsolete in
HTML5.
5. With the help of which tag, is
a row defined in HTML?
a. <row> c.
<row-table>
b. <tr> d. <tablerow>
Answer:
The correct option
is ✅ b. <tr>.
Explanation
The <tr> tag stands for "table
row" and is the standard element used to define a single
horizontal row within an HTML table. It acts as a container for table cells, which
are defined using either <td> (table data) or <th> (table header) tags. Every table row must be placed inside
a <table> element or its structural sub-elements
like <thead>, <tbody>, or <tfoot>.
Why other options are incorrect
·
❌ a. <row>: This is not a standard HTML tag. While
"row" is a conceptual term used to describe table structures, there
is no such element in the HTML specification.
·
❌ c. <row-table>: This is not a valid HTML element. It does
not exist in any version of the HTML standard.
·
❌ d. <tablerow>: While descriptive, this is not the correct
tag name. HTML uses the abbreviated version <tr> to keep the markup concise.
6. By using which of the
following options, the border of table can be collapsed?
a. border-collapse: collapse
b. table-border: collapse
c. border: collapse
d. table-border-collapse:
collapse
Answer:
The correct option is
✅ a. border-collapse: collapse.
Explanation
The border-collapse property in CSS determines whether table
cells have shared or separate borders. When set to the value collapse, adjacent table cell borders are merged into
a single, shared border, removing the default spacing between them.
Why other options are incorrect
·
❌ b.
table-border: collapse: There is no property named table-border in standard CSS; borders are applied via
the border or border-collapse properties.
·
❌ c. border:
collapse: The border property is a
shorthand for setting border width, style, and color (e.g., border: 1px solid
black). It does not accept
"collapse" as a valid value.
·
❌ d.
table-border-collapse: collapse: This is an incorrect syntax. The standard
CSS property is simply border-collapse, not "table-border-collapse".
7. Web browsers display images in
the following format
a. XBM c. JPEG
b. GIF d. All of these
Answer:
The correct option is
✅ d. All of these.
Explanation
Web browsers are
designed to support a variety of image file formats to ensure graphics and
photographs display correctly.
·
JPEG (Joint Photographic Experts Group): The
most common format for photographs on the web due to its high compression
capabilities.
·
GIF (Graphics Interchange Format): Widely
used for simple graphics and animations; it is supported by virtually all
graphical web browsers.
·
XBM (X BitMap): An older plain text binary
image format originally used by the X Window System for icons. While less
common today, it was one of the early formats natively supported by many web
browsers (such as Mosaic) and remains supported in various legacy
contexts.
Why other options are incorrect
·
❌ a. XBM:
While browsers do display XBM files, this is not the only format
they support.
·
❌ b. GIF:
While browsers support GIF files, they also support many other
formats like JPEG and XBM.
·
❌ c. JPEG:
Although JPEG is a standard for web photos, selecting it
exclusively ignores other natively supported formats like GIF and XBM.
8. The correct HTML code for
inserting an image is
a. <img href=”image.gif”>
b. <img>
image.gif</gif>
c. <img src = “image.gif”>
d. <image src = “image.gif”
>
Answer:
The correct HTML code
for inserting an image is c. <img src = “image.gif”>.
The <img> tag is used to embed an image in an HTML
page. The src attribute specifies the path to the
image file, making it a mandatory part of the tag [1].
Here is a breakdown of
the options:
·
a. <img href=”image.gif”>: The href attribute is typically used for links (<a> tags), not images.
·
b. <img>
image.gif</gif>: This is not valid
HTML syntax.
·
c. <img src =
“image.gif”>: This uses the
correct <img> tag and src attribute to specify the image source.
·
d. <image src =
“image.gif” >: The correct tag name
is <img>, not <image>.
For additional
information and examples of using images in HTML, refer to the W3Schools
HTML Images Tutorial.
9. src attribute used with
<img> tag stands for
a. screen c. screen resolution
count
b. source d. structure
Answer: b. source
The src attribute used with the <img> tag stands for source, as it specifies the path or URL to the image file you
want to display on a webpage.
·
b.
source: This is the correct
answer, as src points to the location (source) of the
image file (e.g., image.jpg or https://example.com/image.png).
10. alt attribute allows
a. addition of an alternate
hyperlink
b. addition of a border to image
c. use of an alternative image in
place of the specified image
d.
addition of alternative text about an image
Answer:
The correct option is
✅ d. addition of alternative text about an image.
The alt (alternative) attribute in HTML is used
within the <img> tag to provide a textual description of
an image. This text is essential for:
·
Accessibility: It allows screen readers to describe the
image to visually impaired users.
·
Image
Loading Issues: If an image
cannot be loaded due to a slow connection, a broken file path, or user
settings, the browser displays this alternative text instead of the image.
·
SEO: Search engines use alt text to
understand the content of images, which helps in better ranking and
indexing.
Why other options are incorrect
·
❌ a. addition
of an alternate hyperlink: This is handled by the href attribute within an anchor (<a>) tag, not the alt attribute.
·
❌ b. addition
of a border to image: Borders are traditionally managed using
the border attribute (now largely obsolete) or more
modernly through CSS properties like border-style.
·
❌ c. use of an
alternative image in place of the specified image: Switching between
different images (such as for different screen sizes) is handled by the <picture> element or the srcset attribute, not the alt attribute.
III. APPLICATION BASED QUESTIONS:
a. Ruchika was making
an ordered list and she noticed that the items of the list by default started with
numbers. She wants to use Roman numerals for numbering. How can she do this?
Answer:
Ruchika can use
the type attribute within the <ol> (ordered list) tag in HTML, setting its
value to "I" for uppercase Roman numerals or "i" for lowercase Roman numerals to change
her list's numbering style from default numbers. For example, <ol
type="i"> creates a list
with i,
ii, iii....
How to Implement Roman
Numerals:
1.
For
Uppercase Roman Numerals (I, II, III):
html
<ol type="I">
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ol>
This code will
display:
I. First Item
II. Second Item
III. Third Item
2.
For
Lowercase Roman Numerals (i, ii, iii):
html
<ol type="i">
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ol>
This code will
display:
i. First Item
ii. Second Item
iii. Third Item
By changing the type attribute, she can easily switch between
different numbering styles for her ordered lists in HTML.
b. Rohan has created
a table and he wants that the table border should be collapsed into a single
border. Which property should he use?
Answer:
To collapse table
borders into a single line, Rohan should use the CSS property border-collapse with the value collapse, applied to the <table> element, like this: table {
border-collapse: collapse; }.
This merges adjacent cell borders into one, creating a cleaner look instead of
separate borders for each cell.
How to use it:
·
Target
the table: In your CSS file
or <style> block, select the <table> element.
·
Apply
the property: Set border-collapse to collapse.
css
table {
border-collapse: collapse; /* This makes
borders single */
border: 1px solid black; /* Optional: adds a border to the table itself */
}
td, th {
border: 1px solid black; /* Optional: adds borders to cells */
padding: 8px;
}
This will ensure that
instead of seeing double lines between cells, you'll see a single, unified border.
c. Ashmita has added
few images on her web page but she wants to keep some provisions for the visually
impaired people or users using text-based browsers so that they get the description
for the images. Which attribute should she use to accomplish the task?
Answer:
To provide
descriptions for visually impaired users and text-based browsers, Ashmita
should use the alt attribute (alternative text) within the <img> tag in HTML, which offers descriptive
text read by screen readers or shown if the image fails to load, ensuring
accessibility and understanding.
How to use it:
html
<img
src="your-image.jpg" alt="A detailed description of the image content goes
here">
Why it works:
·
Screen
Readers: Assistive
technologies for the visually impaired read the alt text aloud.
·
Text-Based
Browsers: Users on these
browsers see the description instead of a broken image icon.
·
Image
Loading Errors: If the image
file doesn't load, the alt text is
displayed as a fallback.
·
SEO: Search engines also use alt text to understand image content.
IV. ANSWER THE FOLLOWING:
a. Differentiate
between the <OL> and <UL> tag.
Answer:
<ul> (Unordered List) creates bulleted lists
where order doesn't matter (e.g., shopping items), while <ol> (Ordered List) creates numbered/lettered
lists where sequence is important (e.g., steps in a recipe). The main
difference is purpose: <ol> for
sequences, <ul> for collections, though both use <li> for items and can have their default
styling changed with CSS.
<ul> (Unordered List)
·
Purpose: Lists where the order of items is
irrelevant.
·
Default
Appearance: Bullet points
(discs, circles).
·
Example
Use: Ingredients,
features, or simple lists of things.
html
<ul>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ul>
<ol> (Ordered List)
·
Purpose: Lists where the sequence or order of
items is meaningful.
·
Default
Appearance: Numbers (1, 2,
3) or letters (A, B, C).
·
Example
Use: Step-by-step
instructions, rankings, or processes.
html
<ol>
<li>Preheat oven</li>
<li>Mix ingredients</li>
<li>Bake for 30 minutes</li>
</ol>
Key Differentiator
·
Ask yourself:
"Does changing the order of these items change the meaning?" If yes,
use <ol>. If no, use <ul>
b. Write the syntax
for using list-style-type property.
Answer:
The syntax for the
CSS list-style-type property is
straightforward, using the property name followed by a value that
specifies the desired marker style.
Syntax
css
list-style-type: value;
Usage
The list-style-type property is
typically used within a CSS ruleset targeting list elements such as <ul> (unordered lists), <ol> (ordered lists), or individual <li> (list item) elements. It is also
inherited by list items if set on their parent element.
css
ul {list-style-type: square; /* Example for an unordered list */
} ol {list-style-type: upper-roman; /* Example for an ordered list */
}
Common Property
Values
The value can be one of several keywords, including:
·
disc: The default for <ul> elements; a filled
circle marker (●).
·
circle: A hollow circle marker
(○).
·
square: A filled square marker
(■).
·
decimal: The default for <ol> elements; decimal
numbers starting with 1 (1., 2., 3., etc.).
·
none: No marker is displayed.
·
lower-alpha (or lower-latin): Lowercase letters
(a., b., c., etc.).
·
upper-alpha (or upper-latin): Uppercase letters
(A., B., C., etc.).
·
lower-roman: Lowercase Roman
numerals (i., ii., iii., etc.).
·
upper-roman: Uppercase Roman
numerals (I., II., III., etc.).
More values are available, including various international and
complex counter styles; for a comprehensive list, refer to the MDN Web Docs.
Shorthand Property
The list-style-type property can also
be set using the shorthand list-style property, which allows you to specify the type, position,
and image properties in a single declaration:
css
/* Shorthand syntax */
list-style: square inside;
c. Define Padding
property.
Answer:
The padding property in CSS creates
space inside an
element's border, between the content and the border itself, unlike margin which adds space outside.
It's a shorthand for padding-top, padding-right, padding-bottom, and padding-left, controlling the gaps
on all four sides, and the background color of the element extends into the
padding area.
Key Characteristics
·
Location: Inside the border,
around the content.
·
Effect: Increases the element's total size
(unless box-sizing:
border-box; is used).
·
Background: The set background
color or image of the element shows through the padding area.
Usage
Examples (Shorthand)
·
padding:
20px; W3Schools –
Adds 20px padding on all four sides (top, right, bottom, left).
·
padding:
10px 20px; – 10px top/bottom, 20px left/right.
·
padding:
10px 20px 30px; – 10px top, 20px left/right, 30px bottom.
·
padding:
10px 20px 30px 40px; – 10px top, 20px right, 30px bottom,
40px left (clockwise).
Individual
Side Properties
·
padding-right
·
padding-left
d. What is
description list? Define the different tags used to create a description.
Answer:
A description list in
HTML uses the dl, dt, and dd tags to present name-value pairs,
like terms and definitions, by wrapping the list in <dl>, defining terms with <dt>, and providing descriptions with <dd>, typically indented in browsers.
Tags used in
Description Lists
·
<dl> (Description List): The
container element that wraps the entire description list, defining it as a list
of terms and their descriptions
.
·
<dt> (Description Term): Defines
the term, word, or name that is being described within the list (e.g.,
"Coffee").
·
<dd> (Description Definition): Provides
the description or definition for the preceding <dt> term (e.g.,
"Black hot drink").
Example Structure
html
<dl>
<dt>Term 1</dt>
<dd>Definition for Term 1</dd>
<dt>Term 2</dt>
<dd>Definition for Term 2</dd>
</dl>
Key
Characteristics
·
Purpose: Ideal for
displaying dictionaries, glossaries, or Q&A pairs.
·
Indentation: Browsers usually
display the <dd> content
indented below the <dt>.
·
Flexibility: Can have
multiple <dd> elements
for a single <dt> or
multiple <dt> elements
for a single <dd>.
e. What is the use of
type attribute with an unordered list?
Answer:
The type attribute in an unordered list (<ul>) was used to specify the bullet
style (like disc, circle, square), but it is now deprecated in HTML5, with
developers encouraged to use CSS's list-style-type property for styling instead, as it offers more control
and better separation of concerns (styling vs. structure). The type attribute's values changed bullet
shapes, but modern practice uses CSS for this customization.
How it worked
(Deprecated HTML):
You could set the type attribute on
the <ul> tag:
·
disc (default): A
filled circle (•).
·
circle: A hollow circle (○).
·
square: A filled square
(▪).
html
<!-- Deprecated
HTML example -->
<ul
type="square">
<li>Item 1</li>
<li>Item 2</li>
</ul>
Modern HTML5 Approach
(Using CSS):
For current web development, use CSS for styling:
html
<style>
.my-list {
list-style-type: square; /* Or 'disc',
'circle', 'none',
etc. */
}
</style>
<ul
class="my-list">
<li>Item 1</li>
<li>Item 2</li>
</ul>
Key Takeaway: While you might see the type attribute in older code, always use
the list-style-type CSS property in HTML5 and later for
consistent, maintainable, and powerful styling of list markers.
f. State the use of
any two properties that you use to enhance the appearance of a table.
Answer:
Two properties to
enhance table appearance are Background Color (for highlighting
rows/cells and improving readability) and Borders/Border-spacing (to define
structure, separate cells, and add visual separation/depth). Using background
colors (like alternating row shades) creates visual rhythm, while border
properties control lines between cells for clarity, making complex data easier
to scan and understand.
Here's a closer look at
their uses:
1.
Background Color (Shading):
·
Use: Applying different background colors
to header rows (e.g., dark with white text) or alternating data rows (zebra
striping) helps users quickly distinguish sections and follow data across the
table.
·
Enhancement: Makes tables less
monotonous, draws attention to key information (like totals or headers), and
significantly improves scannability, especially for large datasets.
Border Properties (e.g., border-spacing, border-collapse, border-style):
·
Use: Controls the lines (borders) between
cells and around the table. border-spacing adds gaps between
cells, while border-collapse merges
them into single lines.
·
Enhancement: Defines the
table's structure, preventing data from running together; can create clean,
modern looks (minimal borders) or traditional ones (clear cell dividers).
g. How are images
added in an HTML document?
Answer:
Images are added to
HTML using the self-closing <img> tag, primarily with the required src attribute to point to the image file's
location (URL) and the alt attribute for
descriptive alternative text, ensuring accessibility and display if the image
fails to load. Other optional attributes like width, height, and title can control size
and provide tooltips, as seen in this example: <img
src="photo.jpg" alt="A beautiful landscape"
width="300" title="View of Mountains">.
Key Components:
·
<img> Tag:
An empty,
self-closing tag that embeds an image
.
·
src Attribute
(Required): Specifies the
path or URL to the image file (e.g., image.png, https://example.com/image.jpg).
·
alt Attribute
(Required): Provides
alternative text for screen readers and when the image can't load, improving
accessibility and SEO.
Optional Attributes:
·
width & height: Set the dimensions of the image in pixels.
·
title: Displays a tooltip when the user hovers
over the image.
Example Usage:
html
<img src="my-image.png"
alt="Description of my image" width="200" height="150">
This code links
to my-image.png, shows "Description of my image" if
it fails, and sets its size to 200 pixels wide by 150 pixels high.
V. ACTIVITY
1. Create a web page to
show a list of various colours and their Hex codes (Hexadecimal numerals are
widely used by computer system designers and programmers because they provide a
human-friendly representation of binary-coded values). Also provide image for
the colors you mention in your code.
Answer:
Here's an HTML/CSS
example for a color list with hex codes and color swatches, featuring basic
HTML structure, inline CSS for styling (using <div> elements for each color block), and
placeholder image URLs you'd replace with actual image links for each color to
make them visual. The code demonstrates how to apply colors directly and
explains hex code structure (RRGGBB) for web developers, showing primary,
secondary, and common shades.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta
charset="UTF-8">
<meta
name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Hex Color
Codes & Swatches</title>
<style>
body { font-family:
sans-serif; margin: 20px; background-color: #f4f4f4; }
h1 { color: #333; }
.color-container {
display: flex; flex-wrap: wrap; gap: 20px; }
.color-box {
border: 1px
solid #ccc;
border-radius:
8px;
padding: 15px;
width: 220px;
background-color: #fff;
box-shadow: 2px
2px 5px rgba(0,0,0,0.1);
text-align:
center;
}
.swatch {
width: 100%;
height: 80px;
border-radius:
5px;
margin-bottom:
10px;
border: 1px
solid #eee;
/* Placeholder
for actual image */
background-color: #ddd;
}
.color-name {
font-weight: bold; color: #555; }
.hex-code {
font-family: monospace; color: #007bff; }
</style
</head>
<body>
<h1>Common Hex
Color Codes & Swatches</h1>
<p>Hex codes
(e.g., #RRGGBB) define colors using Red, Green, and Blue values (00-FF), widely
used in web design [3, 7].</p>
<div
class="color-container">
<!-- Red -->
<div
class="color-box" style="background-color: #fff;">
<div
class="swatch" style="background-color:
#FF0000;"></div>
<div
class="color-name">Red</div>
<div
class="hex-code">#FF0000</div>
<!-- Replace
with actual image URL: <img src="path/to/red.png" alt="Red
Swatch"> -->
</div>
<!-- Green -->
<div
class="color-box" style="background-color: #fff;">
<div
class="swatch" style="background-color:
#008000;"></div>
<div
class="color-name">Green</div>
<div
class="hex-code">#008000</div>
</div>
<!-- Blue -->
<div
class="color-box" style="background-color: #fff;">
<div
class="swatch" style="background-color:
#0000FF;"></div>
<div
class="color-name">Blue</div>
<div
class="hex-code">#0000FF</div>
</div>
<!-- Yellow
(Secondary) -->
<div
class="color-box" style="background-color: #fff;">
<div
class="swatch" style="background-color:
#FFFF00;"></div>
<div
class="color-name">Yellow</div>
<div
class="hex-code">#FFFF00</div>
</div>
<!-- Orange
(Secondary) -->
<div
class="color-box" style="background-color: #fff;">
<nav>
<div
class="swatch" style="background-color:
#FFA500;"></div>
<div
class="color-name">Orange</div>
<div
class="hex-code">#FFA500</div>
</nav>
</div>
<!-- Black -->
<div
class="color-box" style="background-color: #fff;">
<div
class="swatch" style="background-color:
#000000;"></div>
2. Create a web page to form a tabular representation of different
mobile names with their features.
Answer:
To create a webpage with a mobile phone comparison table, use
HTML for structure with <table>, <tr>, <th>,
and <td> tags, and add CSS
(within <style> tags
or a separate file) for styling like borders, colors, and spacing, defining
headers (Phone Name, OS, Camera, Price) and rows for each phone's specs to
present data clearly.
1. HTML
Structure (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta
charset="UTF-8">
<meta
name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Mobile
Phone Comparison</title>
<link
rel="stylesheet" href="styles.css"> <!-- Link to your
CSS file -->
</head>
<body>
<h1>Mobile Phone
Comparison</h1>
<table
class="phone-table">
<caption>Compare Popular Smartphones</caption>
<thead>
<tr>
<th>Phone Name</th>
<th>Operating System</th>
<th>Display</th>
<th>Camera (Main)</th>
<th>Processor</th>
<th>Battery (mAh)</th>
</tr>
</thead>
<tbody>
<tr>
<td><<!nav>>Samsung Galaxy
S24<<!/nav>></td>
<td>Android 14</td>
<td>6.2" Dynamic AMOLED 2X</td>
<td>50MP Wide</td>
<td>Snapdragon 8 Gen 3 / Exynos 2400</td>
<td>4000 mAh</td>
</tr>
<tr>
<td><<!nav>>iPhone
15 Pro<<!/nav>></td>
<td>iOS 17</td>
<td>6.1" Super Retina XDR</td>
<td>48MP Main</td>
<td>A17 Pro Chip</td>
<td>~3274 mAh</td>
</tr>
<tr>
<td><<!nav>>Google Pixel
8<<!/nav>></td>
<td>Android 14</td>
<td>6.2" OLED</td>
<td>50MP Wide</td>
<td>Google Tensor G3</td>
<td>4575 mAh</td>
</tr>
<tr>
<td><<!nav>>OnePlus 12<<!/nav>></td>
<td>Android 14</td>
<td>6.82" LTPO AMOLED</td>
<td>50MP Main (Sony LYT-808)</td>
<td>Snapdragon 8 Gen 3</td>
<td>5400 mAh</td>
</tr>
</tbody>
</table>
</body>
</html>
2. CSS Styling
(styles.css)
body {
font-family: Arial,
sans-serif;
background-color:
#f4f4f9;
padding: 20px;
color: #333;
}
h1 {
text-align: center;
color: #0056b3;
}
.phone-table {
width: 90%;
margin: 20px auto;
border-collapse:
collapse; /* Removes space between borders */
background-color: white;
box-shadow: 0 2px 10px
rgba(0, 0, 0, 0.1);
}
.phone-table caption {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 10px;
color: #007bff;
}
.phone-table th, .phone-table td {
border: 1px solid #ddd;
padding: 12px 15px;
text-align: left;
}
.phone-table thead th {
background-color:
#007bff;
color: white;
font-weight: bold;
}
.phone-table tbody tr:nth-child(even) {
background-color:
#f9f9f9; /* Zebra striping for rows */
}
.phone-table tbody tr:hover {
background-color:
#e9e9e9; /* Highlight row on hover */
}
/* Specific styling for key features */
.phone-table td:nth-child(1) { /* Phone Name */
font-weight: 600;
color: #0056b3;
}
PART - III Link, Frames And Forms
Exercise
I. FILL IN THE BLANKS:
1. The web pages of a website are linked to each other using
_________.
2. The attribute _________ is used to create a hyperlink between
two or more HTML codes.
3. When you move the mouse pointer over a link, the mouse pointer
changes its shape from an arrow to a _________.
4. The _________ attribute of the <audio> tag indicates that
you can replay the audio file once it is finished.
5. The small rectangular areas created in the main browser window
are known as ________
6. The _________ attribute of the frame tag tells the browser
which HTML page to load into that frame.
7. ________attribute of the frame tag attaches the default URL.
8. ____________ allow multiple HTML documents to be presented as
independent windows within one browser window.
9. The _________ tag collects the information from the user.
Answer:
Here are the completed
sentences:
1.
The web pages of a
website are linked to each other using hyperlinks (or links).
2.
The attribute href is used to create a hyperlink between
two or more HTML codes.
3.
When you move the
mouse pointer over a link, the mouse pointer changes its shape from an arrow to
a hand (or pointing hand).
4.
The loop attribute of the <audio> tag indicates that you can replay the
audio file once it is finished.
5.
The small rectangular
areas created in the main browser window are known as frames.
6.
The src attribute of the frame tag tells the
browser which HTML page to load into that frame.
7.
longdesc (long
description) attribute of the frame tag attaches the default URL.
8.
Framesets (or Frames) allow multiple
HTML documents to be presented as independent windows within one browser
window.
9.
The <form> tag collects the information from the
user.
II. MULTIPLE CHOICE QUESTIONS:
1. A __________ is a
word, a group of words, or an image that can be used to jump to another
document on the same website or another website.
i. Hyperlink ii. URL
iii. Address iv. none of these
Answer:
The correct answer is
✅ i. Hyperlink.
Explanation
A hyperlink (often
simply called a link) is a digital element such as a word, a group
of words, or an image that acts as a clickable reference. When a user clicks or
taps it, the browser or application "jumps" to a new location, which
can be another document on the same website, a completely different website, or
even a specific section within the current document.
Why other options are incorrect
·
❌ ii. URL:
A URL (Uniform Resource Locator) is the unique web address of
a specific resource or page on the internet. While a hyperlink often contains or
points to a URL, the URL itself is the address, not the clickable word or image
used to initiate the jump.
·
❌ iii. Address:
In the context of the web, Address is typically a synonymous
term for a URL or web address. In a general sense, it refers to a location
(like a physical street address) where something can be found or reached. It is
not the clickable interface element that facilitates navigation.
2. The _________
attribute of the <a> tag is used to set the URL of the target resource.
i. src ii. href iii.
Controls iv. none of these
Answer:
The correct option is
✅ ii. href.
Explanation
The href attribute
(short for "hypertext reference") is used within the anchor tag <a> to specify the destination URL or
address of the resource that the link points to. When a user clicks on the
content between the opening <a> and closing </a> tags, the browser navigates to the URL defined in this
attribute.
Why other options are incorrect
·
❌ src:
This attribute stands for "source" and is used to embed external
content like images (<img>),
videos (<video>), or scripts (<script>) into a document, rather than creating a clickable link to a
new resource.
·
❌ Controls:
This is a boolean attribute used specifically with media tags like <audio> and <video> to display playback controls such as play, pause, and
volume.
·
❌ none of
these: This option is incorrect because href is the
standard and correct attribute for this purpose.
3. Which of the
following can be embedded in a web page?
i. Audio ii. Video
iii. Both (i) and (ii) iv. None of these
Answer:
The correct option is
✅ iii. Both (i) and (ii).
Explanation
Both audio and video files
can be embedded directly into a web page using HTML5.
·
Audio: The <audio> tag is used to embed sound files like MP3, WAV, or OGG.
·
Video: The <video> tag allows for the embedding of movie clips or video
streams in formats such as MP4, WebM, or OGG.
Modern web browsers support these elements natively, allowing multimedia
content to play without the need for external plugins like Flash.
Why other options are incorrect
·
❌ i. Audio:
While audio can be embedded, this option is incomplete because video can also
be embedded.
·
❌ ii. Video:
Similarly, this option is incomplete as it ignores the ability to embed audio.
·
❌ iv. None of
these: This is incorrect because both audio and video are standard elements
that can be embedded into web pages using current HTML specifications.
4. The ____________
attribute of the <video> tag plays the video file automatically on loading
a web page.
i. controls ii.
Autoplay iii. Height iv. none of these
Answer:
The correct option is
✅ ii. Autoplay.
The autoplay attribute
is a Boolean attribute used in the HTML <video> (and <audio>)
tag to signal the browser that the media file should begin playing immediately
as soon as it has loaded sufficiently, without requiring any user
interaction.
Explanation
·
Purpose: It is designed to enhance user experience
for background videos or media-heavy pages where immediate playback is desired.
·
Usage
Requirement: In modern browsers
(like Chrome and Safari), the autoplay attribute often requires the muted attribute to be present; otherwise, the
browser may block the automatic playback to prevent intrusive audio for the
user.
Why other options are incorrect
·
❌ i. controls:
This attribute is used to display the standard playback interface, including
the play/pause button, volume slider, and seek bar.
·
❌ iii. Height:
This attribute defines the vertical dimension of the video player area on the
webpage in pixels.
·
❌ iv. none of
these: This is incorrect because autoplay is the specific
and correct attribute for this function.
5. ________ tag is
used to create textbox, radio button and checkbox on the web page.
i. <OPTION> ii. <INPUT> iii. Both of these iv. None of
these
Answer:
The correct option
is ✅ ii. <INPUT>.
Explanation
The <INPUT> tag is a versatile HTML element used to
create various interactive form controls on a webpage. By setting its type attribute, developers can specify the
specific control they want to display:
·
Textbox: Created using <input
type="text">.
·
Radio
Button: Created using <input
type="radio">.
·
Checkbox: Created using <input
type="checkbox">.
Why other options are incorrect
·
❌ <OPTION>:
This tag is used inside <SELECT> or <DATALIST> elements to define individual items in a
dropdown list or menu, not for creating general textboxes or radio buttons.
·
❌ Both of
these: Since <OPTION> cannot create the mentioned controls, this option is
false.
·
❌ None of
these: Since <INPUT> is the correct tag for all three controls, this option is
false.
III. APPLICATION BASED QUESTIONS:
1. Rohan wants to
divide a web page into four sections. Which tag should he use to accomplish
this?
Answer:
To divide a webpage
into four sections, Rohan should primarily use the <div> tag as a generic container for grouping
elements, often combined with CSS for layout, or use semantic HTML5 tags
like <section> for more meaningful structure,
though <div> is the most versatile for arbitrary
divisions.
Here's how he can do
it:
1.
Using <div> Tags (Most Common):
·
This is a generic
block-level container for grouping content and applying styles.
·
Example:
html
<div class="section-one">Section
1
Content</div>
<div class="section-two">Section
2
Content</div>
<div class="section-three">Section
3
Content</div>
<div class="section-four">Section
4
Content</div>
·
He would then use CSS
(e.g.,
display:
flex
or CSS Grid) to
position these
div
s into four distinct
areas
.
Using
HTML5 <section> Tags (Semantic):
·
For semantically
meaningful sections (like a chapter, a tab, or a thematic grouping), <section> is better.
·
Example:
html
<section>Section 1</section>
<section>Section 2</section>
<section>Section 3</section>
<section>Section 4</section>
Using <iframe> (For Separate Documents):
·
If each section needs
to be a completely separate webpage or document loaded within the current
page, <iframe> tags can create frames, though this is
less common for general layout today.
For simple division
and styling, <div> is the go-to, while <section> offers better structure for modern web
development.
2. Rahim is creating
a website in which he wants to use different images as links to the web pages.
He is also interested in adding some video clips in his website. Can you suggest
him the required tags to include the said elements in his website.
Answer:
To make images
clickable links and embed videos, Rahim needs to nest the <img> tag inside the <a> (anchor) tag for image links, and use
the <video> tag with <source> and the controls attribute for videos, specifying file
paths with href and src attributes, respectively, in HTML.
1. Image as a Link (Image Hyperlink)
·
Tags
Used: <a> (anchor) and <img> (image).
·
How
it Works: Wrap the <img> tag within the <a> tag. The href attribute of the <a> tag points to the destination webpage,
and the src attribute of the <img> tag points to the image file.
·
Example:
html
<a href="destination-page.html">
<img src="image-link.jpg" alt="Link to Another
Page" width="100" height="50">
</a>
o href="destination-page.html": The URL of the page the image links to.
o src="image-link.jpg": The path to your image file.
o alt="Link to
Another Page": Text description for
accessibility.
2. Adding Video Clips (Embedded
Video)
·
Tags
Used: <video> and <source>.
·
How
it Works: The <video> tag is the container, and the <source> tag specifies the video file (with
different formats for browser compatibility). The controls attribute adds play/pause/volume
buttons.
·
Example:
html
<video width="320" height="240"
controls>
<source src="my-video.mp4" type="video/mp4">
<source src="my-video.webm" type="video/webm">
Your browser does not support the video tag.
</video>
o width/height: Sets video dimensions.
o controls: Adds player controls.
o src="my-video.mp4": Path to your video file.
o type="video/mp4": Specifies the video's MIME type.
Key Attributes:
·
<a> tag: href (URL).
·
<img> tag: src (image source), alt (alternative text).
·
<video> tag: controls, width, height.
·
<source> tag: src (video source), type (MIME type).
3. Ritika was writing
an article using HTML. The article contains some external links to other website
contains additional information. How can she link these together so that the
user can visit the destination of the external links by clicking on them?
Answer:
Ritika can link to
external websites in her HTML article using the anchor (<a>) tag. This tag transforms the text it
encloses into a clickable link.
The basic syntax is as
follows:
html
<a
href="URL_of_the_external_site">Link
Text</a>
Here is a breakdown of
the key components:
·
<a>:
This is the anchor tag itself, indicating the start of the link.
·
href attribute: This attribute specifies the destination URL
(the address of the external website).
·
URL_of_the_external_site: The full web address, including https://.
·
Link Text:
This is the visible text in the article that the user will click on.
Example in Practice
If Ritika wanted to
link to the Wikipedia homepage, the code in her HTML document would look like
this:
html
<p>For
more information on HTML, please visit the official page on
<a
href="https://www.wikipedia.org">Wikipedia</a>.</p>
Best Practice for External Links
It is a common
practice to make external links open in a new browser tab so that users do not
navigate away from Ritika's article. This is achieved by adding the target="_blank" attribute to the anchor tag:
html
<a
href="https://www.wikipedia.org"
target="_blank">Wikipedia</a>
4. Priyanka wants to
create a form but she has forgotten the tag used to create the form. Can you
help her with the solution?
Answer:
Priyanka needs the form> tag in HTML to
create a form for user input, which acts as a container for elements like text
fields, buttons, and checkboxes. You simply open with <form> and close with </form>, adding attributes like action (where to send data) and method (GET/POST) inside the opening tag, like this: <form action="/submit-page"
method="POST"> ... </form>.
How to Use the <form> Tag:
1.
Start the form: Use <form> to begin your form
structure.
2.
Add attributes: Inside the
opening <form> tag,
specify where to send data with action="..." and
the submission method with method="..." (e.g., GET or POST).
3.
Add form elements: Place input
fields, text areas, radio buttons, checkboxes, and submit buttons between the <form> and </form> tags.
4.
End the form: Use </form> to close the form.
Example:
html
<form action="/submit-data.php" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<input type="submit" value="Submit">
</form>
IV. ANSWER THE FOLLOWING:
1. Why do you include
hyperlinks in your web page? Give any two reasons.
Answer:
Hyperlinks are included
on web pages primarily for navigation,
allowing users to easily move between related content, and to provide context/depth,
offering more detailed information or sources without cluttering the main page,
thereby improving user experience and organizing information effectively.
Two Key Reasons for
Hyperlinks:
1.
Enhanced Navigation & User
Experience: Hyperlinks create pathways, letting users click from one page
to another (within the same site or externally) or to different sections of the
same page, making it easy to explore topics, find information, and find what
they need quickly without complex searching.
2.
Context, Organization &
Credibility: They allow creators to link to definitions, related articles,
or sources, offering extra detail without overwhelming the reader, making pages
cleaner and more organized. For search engines, relevant internal and external
links signal a rich, credible, and interconnected site, potentially boosting
SEO.
2. Distinguish between
the internal and external linking.
Answer:
Internal linking
connects pages within the
same website or domain (e.g., from your blog to your contact page), improving
site navigation and SEO by distributing authority, while external linking
connects to other,
separate websites (e.g., linking a statistic to a research paper) to add
credibility, provide more info, and build trust with users and search engines.
The key difference is destination: same site vs. different site.
·
Definition: A hyperlink that
points from one page on your website to another page on the same website.
·
Purpose: Helps users find
related content, keeps them on your site longer, improves site structure, and
helps search engines crawl and understand your site.
·
Examples: Linking from a blog
post to a product page, or from your homepage to a specific service page.
·
Definition: A hyperlink that
points from your website to a page on a different website
or domain.
·
Purpose: Adds credibility,
backs up claims with authoritative sources (like studies or statistics), offers
additional resources, and builds trust by showing you're connected to the wider
web.
·
Examples: Linking a statistic in
your article to the original research study, or linking to a reputable news
source.
Key Differences
·
Destination: Internal links stay
within your domain; external links go to other domains.
·
Control: You fully control
internal links; you can't control external sites, but you choose reputable
ones.
·
User Flow: Internal links keep
users on your site; external links send them away (often opening in a new tab).
·
SEO Role: Internal links boost
site navigation & authority flow; external links build your site's
trustworthiness and context.
3. What are frames?
How are they useful?
Answer:
Frames
are structured containers that divide a window or document into
independent sections, useful for organizing content, creating consistent
layouts (like fixed menus with scrolling content), and managing data in web
design, networking, and computer science by isolating elements for independent
loading or processing, enhancing modularity and user experience, though they're
largely superseded by modern CSS and iframes in web development.
In Web Design (HTML Frames)
·
What
they are: A technique to split
a browser window into multiple, independent panes, each loading a different
HTML document, using <frameset> and <frame> tags (now mostly obsolete).
·
How
they're useful:
o Simultaneous Display: Show multiple documents (e.g., a menu and
content) at once.
o Consistent Layout: Keep navigation bars or headers static while
content changes.
o Efficiency: Only reload the changing frame, reducing bandwidth.
·
Modern
Alternatives: Replaced by <iframe> (inline frames) and CSS for better SEO,
accessibility, and flexibility.
In Computer Science & Networking
(Data Frames)
·
What
they are: Standardized units
of data, often called packets, with headers and trailers, used for
transmission.
·
How
they're useful:
o Organization: Break data into manageable chunks.
o Reliability: Headers help with error detection, correction, and
synchronization.
o Modularity: Allow complex systems to be built from reusable
components.
In Animation
·
What
they are: Individual images or
drawings in a sequence.
·
How
they're useful: Played in quick
succession to create the illusion of motion.
4. What are two types
of text input in HTML web forms?
Answer:
The two types of text
input in HTML web forms are single-line and multi-line [1, 2].
1. Single-line Text Input
Single-line text
inputs are created using the <input type="text"> element and are used for capturing
short, single-line text information like names, email addresses, search
queries, or telephone numbers [1, 2, 3].
·
Example: <input type="text"
id="username" name="username">
·
This input renders a
small, rectangular box that users can type into [1]. If the user types a string
longer than the box can hold, the text will scroll horizontally within the box
[1].
2. Multi-line Text Input
Multi-line text inputs
are created using the <textarea> element
and are used for capturing longer-form content such as comments, feedback, or
detailed descriptions [1, 2, 3].
·
Example: <textarea id="feedback"
name="feedback" rows="4"
cols="50"></textarea>
·
This input renders as
a larger text area that typically spans multiple lines [1]. Unlike single-line
inputs, it often includes a "grab handle" that allows users to resize
the input box horizontally and vertically, depending on the browser [1].
5. Which input
control is most useful for questions requiring a simple yes or no answer?
Answer:
For simple Yes/No
questions, use radio
buttons if you need to force a choice (ensuring the user
picks one), or a single checkbox if you prefer a
concise, opt-in/opt-out style (often left unchecked by default). For clear,
required binary choices, dedicated Yes/No
components or radio buttons are often better than a single
checkbox because they prevent users from missing the answer, notes SAP's Help
Portal, User Experience
Stack Exchange, and LogRocket Blog.
When to Use Radio
Buttons
·
Forced Choice: When the
user must select "Yes" or
"No" (e.g., "Do you agree to the terms?").
·
Clarity: Presents "Yes"
and "No" as explicit, mutually exclusive options.
When to Use a Checkbox
·
Opt-In: Best for optional
confirmations (e.g., "Sign me up for the newsletter") where the
default is "No" (unchecked).
·
Conciseness: Visually simpler
for basic agreements or confirmations.
Modern Alternatives
·
Toggle Switch: A visual
alternative to radio buttons or checkboxes, clearly showing an on/off (Yes/No)
state, often preferred for its modern feel and accessibility, according to
Medium.
In summary: For critical, required Yes/No answers, radio buttons or
specialized Yes/No
components are generally superior for ensuring a response;
use a checkbox for
optional settings.
6. What is the use of
password control in HTML forms?
Answer:
The password control in HTML forms (<input
type="password">)
is used to securely collect sensitive information, such as login passwords
[1, 2].
Its primary uses and
functions are:
·
Obfuscation: When a user types into a password field, the
characters entered are masked or hidden from view, typically appearing as
asterisks (*) or dots (•) [1, 2]. This is crucial for security as it prevents
people nearby from seeing the sensitive credentials being entered [2].
·
Security
for Transmission: While the characters
are hidden in the browser, the data is still transmitted to the web server
(ideally over a secure HTTPS connection) in plain text unless further encrypted
by other security protocols [2]. The obfuscation is purely a user interface
feature.
·
Form
Submission: The input field acts
like any other text input, allowing the user's input to be sent with the rest
of the form data when the form is submitted (e.g., when a user clicks a
"Log In" or "Submit" button) [1, 2].
In summary, the password control is essential for user privacy
and basic security by obscuring the input on the screen, making it a standard
component of any authentication form [1, 2].
7. What is the use of
<INPUT> tag?
Answer:
The <input> tag in HTML creates interactive
fields within forms, allowing users to enter data like text, passwords,
numbers, emails, or select options via checkboxes, radio buttons, and
dropdowns; it's fundamental for collecting user information for websites,
controlled by the type attribute
(e.g., type="text", type="radio", type="submit") to define the input's behavior and
appearance.
Key Uses of <input> Tag
·
Data
Collection: Gathers user
details (names, emails, comments) for forms, surveys, and sign-ups.
·
Interactive
Controls: Creates various
elements like text boxes, password fields, file uploads, date pickers, and
more.
·
Form
Submission: Includes submit
buttons (<input
type="submit">)
to send collected data to a server.
·
User
Experience: Offers different
types for specific data validation (like type="email" or type="number") and includes features like placeholders and
required fields.
Common type Attributes
·
text: A single-line text
field (default).
·
password: Hides characters for
privacy.
·
email: Ensures a valid
email format.
·
number: Accepts numerical
input.
·
checkbox: Allows multiple
selections.
·
radio: Allows only one
selection from a group.
·
submit: A button to submit
the form.
·
file: Lets users upload
files.
·
date, time, color, range: For specific data
types.
Example
html
<form>
<label for="username">Username:</label>
<input type="text" id="username"
name="username"><br><br>
<label for="email">Email:</label>
<input type="email" id="email"
name="email"><br><br>
<input type="checkbox" id="subscribe"
name="subscribe" value="yes">
<label for="subscribe">Subscribe to newsletter</label><br><br>
<input type="submit" value="Submit">
</form>
8. What are the uses of Submit and Reset buttons?
Answer:
Submit buttons send form
data to a server for processing (like logging in or sending a message), while
Reset buttons clear all user input in a form, returning fields to their default
(usually empty) state, allowing the user to start over easily. They are
fundamental HTML form controls, with Submit acting as the "send"
action and Reset as the "clear" or "start fresh" option for
users.
Submit Button (type="submit")
·
Purpose: To send the data
entered into a form to a specified URL (Action attribute) on a server for
handling.
·
Action: Triggers the
form's submission process, often leading to a new page, data processing, or
database entry.
·
Example: Clicking
"Login" on a login form, "Send" on a contact form, or
"Place Order" on a shopping cart.
Reset Button (type="reset")
·
Purpose: To erase all data
the user has typed into the form fields.
·
Action: Sets all form
inputs (text boxes, checkboxes, radio buttons, etc.) back to their initial
default values (e.g., empty).
·
Example: Clearing a long
registration form to fill it out again quickly, or correcting accidental
entries.
V. LAB ACTIVITY
1. Create a web page
where a person has top choose a day of the month from a drop – down list. The page
should also allow the person to enter two lines on what the person plans to do
on.
Answer:
<!DOCTYPE html>
<html lang="en">
<head>
<meta
charset="UTF-8">
<meta
name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Daily
Planner</title>
<style>
body {
font-family:
Arial, sans-serif;
margin: 20px;
padding: 20px;
max-width:
500px;
background-color: #f4f4f4;
}
.form-container {
background:
white;
padding: 20px;
border-radius:
8px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
label {
display: block;
margin-bottom:
5px;
font-weight:
bold;
}
select, textarea,
button {
width: 100%;
padding: 10px;
margin-bottom:
15px;
border: 1px
solid #ccc;
border-radius:
4px;
box-sizing:
border-box; /* Ensures padding doesn't affect width */
}
textarea {
height: 100px;
resize:
vertical;
}
button {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color:
#45a049;
}
</style>
</head>
<body>
<div
class="form-container">
<h2>Daily
Planner</h2>
<form
action="#" method="post" id="plannerForm">
<!-- Day of
the Month Drop-down List -->
<label for="day">Choose
a day of the month:</label>
<select
id="day" name="day" required>
<option
value="">--Select Day--</option>
<!--
Generate options for days 1 to 31 using JavaScript or manually -->
<script>
for (let
i = 1; i <= 31; i++) {
document.write(`<option
value="${i}">${i}</option>`);
}
</script>
</select>
<!-- Two
lines for plans -->
<label
for="plans">What do you plan to do?</label>
<textarea
id="plans" name="plans" rows="4"
placeholder="Enter your plans here (e.g., Line 1: Go to the gym, Line 2:
Meet with team)" required></textarea>
<!-- Submit
Button -->
<button
type="submit">Save Plans</button>
</form>
</div>
<!-- Optional
JavaScript to handle form submission -->
<script>
document.getElementById('plannerForm').addEventListener('submit',
function(event) {
event.preventDefault(); // Prevent
the default form submission
const day =
document.getElementById('day').value;
const plans =
document.getElementById('plans').value;
alert(`Plans for
Day ${day} saved:\n\n${plans}`);
// Here you
could add logic to send data to a server
});
</script>
</body>
</html>
2. Create an HTML
document on the topic HTML list and HTML Tables. The web page should contain
two frames where in one frame with HTML List and in other HTML Tables.
Answer:
While the
traditional <frameset> and <frame> elements are obsolete in HTML5, the effect of displaying
multiple independent HTML documents can be achieved using <iframe> elements combined with CSS for layout.
The following example
uses three separate HTML files: a main file (index.html) that uses CSS to place two <iframe>s side-by-side, which in turn load lists.html and tables.html.
1. Create the content files
Create the following
two files and save them in the same directory as your main file:
lists.html
<!DOCTYPE html>
<html>
<head>
<title>HTML Lists
Content</title>
<style>
body { font-family:
sans-serif; padding: 20px; background-color: #f0f8ff; }
h2 { color: #005f73;
}
</style>
</head>
<body>
<h2>HTML
Lists</h2>
<h3>Unordered
List</h3>
<ul>
<li>Item
1</li>
<li>Item
2</li>
<li>Item
3</li>
</ul>
<h3>Ordered
List</h3>
<ol>
<li>First
Item</li>
<li>Second
Item</li>
<li>Third
Item</li>
</ol>
</body>
</html>
tables.html
<!DOCTYPE html>
<html>
<head>
<title>HTML Tables Content</title>
<style>
body { font-family: sans-serif; padding: 20px; background-color: #fffafa; }
h2 { color: #9400d3; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; }
</style>
</head>
<body>
<h2>HTML Tables</h2>
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
</tr>
</tbody>
</table>
</body>
</html>