Module 1
Module 1
Q. 1 Explain basic Internet Protocols which are essential for transferring data
and sending emails.
1. Internet Protocol (IP):
• IP is the fundamental protocol that enables the transfer of data from one device to
another over the internet.
• It defines how data packets are sent from a source to a destination, ensuring that
each packet gets to the right location.
• Uses unique IP addresses (IPv4 or IPv6) to identify each device.
2. Transmission Control Protocol (TCP):
• TCP is responsible for ensuring that data packets are transmitted reliably between
devices.
• It works alongside IP (forming the TCP/IP model) to guarantee that data is delivered
accurately and in the correct order.
• Establishes a connection using a "handshake" before transmitting data.
3. User Datagram Protocol (UDP):
• A faster, connectionless protocol for sending data without guarantees of reliability.
• Does not establish connections or perform error checking, making it suitable for real-
time applications.
• Used in scenarios where speed is more important than accuracy (e.g., live streaming,
online gaming).
4. Simple Mail Transfer Protocol (SMTP):
• SMTP is the protocol used for sending emails from a client to a server or from one
server to another.
• It defines how email messages are sent and routed between mail servers.
5. Hypertext Transfer Protocol (HTTP/HTTPS):
• HTTP is used for transferring web pages and data between browsers and servers.
• Follows a request-response model, where the client requests data and the server
responds.
• HTTPS is a secure version that encrypts communication using SSL/TLS to protect
data.
• Stateless by nature, meaning each request is independent of the previous one.
6. File Transfer Protocol (FTP)
• FTP is used for transferring files between a client and a server over a network.
• It allows users to upload, download, and manage files on a remote server.
7. Post Office Protocol (POP3)
• POP3 is used to retrieve emails from a mail server to a client.
• It downloads emails from the server to the user’s local device and then (typically)
deletes them from the server.
2 It uses cookies to store temporary data. It uses SQL databases and application
cache to store offline data.
3 Does not allow JavaScript to run in the Allows JavaScript to run in the
browser. background. This is possible due to JS
Web worker API in HTML5.
4 It does not allow drag and drop effects. It allows drag and drop effects.
5 Not possible to draw shapes like circle, HTML5 allows to draw shapes like circle,
rectangle, triangle etc. rectangle, triangle etc.
6 It works with all old browsers. It supported by all new browser like
Firefox, Mozilla, Chrome, Safari, etc.
7 <HTML>,<Body> , and <Head> tags are These tags can be omitted while writing
mandatory while writing a HTML code. HTML code.
8 Older version of HTML are less mobile- HTML5 language is more mobile-friendly.
friendly.
9 Doctype declaration is too long and Doctype declaration is quite simple and
complicated. easy.
10 Elements like nav, header were not New element for web structure like nav,
present. header, footer etc.
12 Being an older version , it is not fast , It is efficient, flexible and more fast in
flexible , and efficient as compared to comparison to HTML.
HTML5.
13 Attributes like charset, async and ping Attributes of charset, async and ping are a
are absent in HTML. part of HTML 5.
Ex :
<html>
<head>
<title>My title</title>
</head>
<body>
<h1 id="header">Welcome to the DOM</h1>
<a href="https://example.com" target="_blank">Click here</a>
</body>
</html>
Syntax:
<td colspan="number">...</td>
Syntax:
<td rowspan="number">...</td>
Ex :
<!DOCTYPE html>
<html>
<head>
<title>Table with Rowspan and Colspan Example</title>
</head>
<body>
<table border="1">
<tr>
<th colspan="2">Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td rowspan="2">Row 1, Cell 1<td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
<tr>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
</body>
</html>
3. <section>
The <section> tag defines a section of content, typically with a thematic grouping. It is used
for grouping related content within a web page, such as a group of articles, a set of services,
or any content related to a particular theme.
Example :
<section>
<h2>Our Services</h2>
<p>We offer web development, graphic design, and SEO services.</p>
</section>
4. <article>
The <article> tag represents independent content that can stand alone or be distributed
outside of the website, such as blog posts, news articles, or forum posts. Each <article>
element should be self-contained.
Example :
<article>
<h2>Understanding Semantic HTML</h2>
<p>Semantic HTML5 introduces new elements to describe the content of web
pages...</p>
</article>
5. <footer>
The <footer> tag defines the footer section of a webpage or a section. Typically, it contains
information like copyright details, links to privacy policies, or contact information.
Example :
<footer>
<p>© 2024 My Website. All Rights Reserved.</p>
<nav>
<a href="#">Privacy Policy</a> |
<a href="#">Terms of Service</a>
</nav>
</footer>
Q. 8 Explain how Shadow effect can be applied on Text using CSS with
suitable example.
1. In CSS, the shadow effect can be applied to text using the text-shadow property.
2. This property allows you to add one or more shadows to the text of an element,
creating various visual effects.
3. In its simplest use, you only specify the horizontal shadow (2px) and the vertical
shadow (2px)
Syntax of text-shadow:
text-shadow: h-shadow v-shadow blur-radius color;
• h-shadow: The horizontal shadow (required). Positive values shift the shadow to
the right, negative values shift it to the left.
• v-shadow: The vertical shadow (required). Positive values move the shadow down,
and negative values move it up.
• blur-radius: The blur distance (optional). The higher the value, the more blurred
the shadow will be. If omitted, the shadow is sharp.
• color: The color of the shadow (optional). It can be specified in any valid CSS color
format (name, hex, rgb, rgba, etc.).
Applying a simple shadow effect to text:
Ex :
<html>
<head>
<style>
h1 {
text-shadow: 2px 2px 4px gray;
}
</style>
</head>
<body>
<h1>Shadow Effect on Text</h1>
</body>
</html>
Explanation:
2px 2px 4px gray:
1. 2px: The shadow is 2 pixels to the right of the text (horizontal shadow).
2. 2px: The shadow is 2 pixels below the text (vertical shadow).
3. 4px: The shadow has a blur radius of 4 pixels, creating a soft, blurred shadow.
4. gray: The color of the shadow is gray.
Syntax:
<style>
#parentclass {
color: red;
}
</style>
<div id="parentclass">
Parent Div
<div id="div1Child">Child Div 1</div>
<div id="div2Child">Child Div 2</div>
</div>
Example :
<!DOCTYPE html>
<html>
<head>
<style>
#parentclass {
padding: 30px;
color: red;
}
#Child {
padding: inherit;
}
</style>
</head>
<body>
<div id="parentclass">
Parent
<div id="Child">Child</div>
</div>
</body>
</html>
@keyframes animation-name {
0% { /* styles at the start */ }
50% { /* styles halfway */ }
100% { /* styles at the end */ }
}
Example :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3 Animation Example</title>
<style>
/* Keyframes for the animation */
@keyframes moveAndChangeColor {
0% {
background-color: blue;
left: 0;
}
50% {
background-color: green;
left: 50%;
}
100% {
background-color: red;
left: 100%;
}
}
/* Applying the animation to the element */
.box {
width: 100px;
height: 100px;
position: absolute;
background-color: blue;
animation-name: moveAndChangeColor;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
Q. 12 Create an External stylesheet and link it to an HTML form, the stylesheet should
contain following:
i. An header in text with red text color and yellow background color.
ii. A double lined(border) table.
iii. The table should have 5 rows and 3 columns.
iv. In the first column Sr. No. of the Product, Second column image with hyperlink and
name of the product, and Third column the description of the product.
table, th, td {
border: 2px double black;
}
Q. 13 Create an External stylesheet and link it to an HTML form, the stylesheet should
contain following :
i. The web page will have the background image(image.jpg).
ii. The table heading have the red background color.
iii. Background color of alternate paragraph are different.
iv. The hyperlink on web page will not have underlined.
/* ii. Style for the table heading with red background color */
table th {
background-color: red;
color: white; /* Optional: Makes the text white for contrast */
padding: 10px;
}
p:nth-child(even) {
background-color: #e0e0e0; /* Slightly darker background for even paragraphs */
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Styled Form with External CSS</title>
<!-- Link to the external stylesheet -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<br>
</body>
</html>
Q. 14 List and explain the 3 way to add style sheet(CSS) to an HTML web
page with suitable example.
1. CSS is a style sheet language that describes the presentation of a document written
in HTML.
2. CSS describes how HTML elements should be displayed on the screen
Include CSS In HTML
There are 3 different ways to include CSS in HTML.
1. Inline CSS - Inline CSS is the CSS code that is written inside the HTML tag.
2. Internal CSS - Internal CSS is the CSS code that is written inside the HTML file in
the <style> tag.
3. External CSS - External CSS is written in a separate CSS file and is included in the
HTML file using the <link> tag.
1. Inline CSS
• Inline CSS is the CSS code that is written inside the HTML tag.
• An inline style may be used to apply a unique style for a single element.
• To use inline styles, add the style attribute to the relevant element. The style
attribute can contain any CSS property.
• Example :
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;text-align:center;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
</body>
</html>
2. Internal CSS
• The internal CSS is also known as the embedded CSS
• Internal CSS is the CSS code that is written inside the HTML file in
the <style> tag.
• An internal style sheet may be used if one single HTML page has a unique
style.
• The internal style is defined inside the <style> element, inside the head
section.
• Example :
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
3. External CSS
• External CSS is written in a separate CSS file and is included in the HTML file
using the <link> tag.
• With an external style sheet, you can change the look of an entire website by
changing just one file!
• Each HTML page must include a reference to the external style sheet file
inside the <link> element, inside the head section.
• Example :
HTML Code :
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
h1 {
color: navy;
margin-left: 20px;
}