Full Stack
Full Stack
Full Stack
<h2>Ordered List</h2>
<ol>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ol>
<h2>Unordered List</h2>
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ul>
<h2>Nested List</h2>
<ul>
<li>Fruits
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</li>
<li>Vegetables
<ul>
<li>Carrot</li>
<li>Broccoli</li>
</ul>
</li>
</ul>
<h2>Definition List</h2>
<dl>
<dt>HTML</dt>
<dd>A markup language used to create web pages</dd>
<dt>CSS</dt>
<dd>A style sheet language used to describe the
presentation of a web page</dd>
</dl>
</body>
</html>
b. HTML Program to Explain Working of Hyperlinks Using <a> Tag and href,
target Attributes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Hyperlinks Example</title>
</head>
<body>
<h1>Working with Hyperlinks</h1>
<div>
<!-- Thumbnail 1 -->
<a href="image1-large.jpg">
<img src="image1-thumbnail.jpg" alt="Image 1"
width="100" height="100">
</a>
<!-- Thumbnail 2 -->
<a href="image2-large.jpg">
<img src="image2-thumbnail.jpg" alt="Image 2"
width="100" height="100">
</a>
<!-- Thumbnail 3 -->
<a href="image3-large.jpg">
<img src="image3-thumbnail.jpg" alt="Image 3"
width="100" height="100">
</a>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>HTML Table Example</title>
</head>
<body>
<h1>HTML Table Example</h1>
<table border="1">
<caption><strong>Student Information
Table</strong></caption>
<tr>
<th>Name</th>
<th>Age</th>
<th>Grade</th>
<th>Address</th>
</tr>
<tr>
<td>John Doe</td>
<td>15</td>
<td>A</td>
<td>1234 Elm St, Springfield</td>
</tr>
<tr>
<td>Jane Smith</td>
<td>16</td>
<td>B</td>
<td>5678 Oak St, Rivertown</td>
</tr>
<tr>
<td>Mary Johnson</td>
<td>17</td>
<td>C</td>
<td>9101 Pine St, Lakeview</td>
</tr>
<tr>
<td colspan="2">Total Students</td>
<td colspan="2">3</td>
</tr>
<tr>
<td rowspan="2">Teacher</td>
<td>Mr. Adams</td>
<td colspan="2">Science Teacher</td>
</tr>
<tr>
<td>Ms. Turner</td>
<td colspan="2">Math Teacher</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Timetable</title>
<style>
table {
width: 80%;
border-collapse: collapse;
margin: 20px auto;
}
th, td {
border: 1px solid #000;
padding: 10px;
text-align: center;
}
caption {
font-size: 24px;
font-weight: bold;
margin: 10px;
}
</style>
</head>
<body>
<h1>Student Timetable</h1>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Registration Form</title>
<style>
table {
width: 60%;
margin: 20px auto;
border-collapse: collapse;
}
th, td {
padding: 10px;
text-align: left;
border: 1px solid #ccc;
}
th {
background-color: #f4f4f4;
}
caption {
font-size: 24px;
font-weight: bold;
margin: 10px;
}
</style>
</head>
<body>
</body>
</html>
d. Write a HTML program, to explain the working of frames, such
that page is to be divided into 3 parts on either direction.
(Note: first frame image, second frame paragraph, third
frame hyperlink. And also make sure of using “no frame”
attribute such that frames to be fixed).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Frames Example</title>
</head>
<body>
<h1 align="center">HTML Frames Example</h1>
<noframes>
<body>
<p>Your browser does not support frames. Please
upgrade your browser or use a modern browser to view this
page.</p>
</body>
</noframes>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>HTML5 Semantic Elements</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #4CAF50;
color: white;
padding: 15px;
text-align: center;
}
nav {
background-color: #333;
color: white;
padding: 10px;
}
nav ul {
list-style-type: none;
padding: 0;
}
nav ul li {
display: inline;
margin-right: 20px;
}
nav ul li a {
color: white;
text-decoration: none;
}
main {
padding: 20px;
}
section {
margin-bottom: 20px;
}
footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px;
position: fixed;
bottom: 0;
width: 100%;
}
article {
background-color: #f4f4f4;
padding: 15px;
margin-bottom: 20px;
}
aside {
background-color: #f4f4f4;
padding: 15px;
margin-top: 20px;
}
figure {
margin: 0;
padding: 0;
}
figcaption {
text-align: center;
font-style: italic;
}
</style>
</head>
<body>
</body>
</html>
<div class="media-container">
<!-- Audio Player -->
<div class="audio">
<h2>Audio Example</h2>
<audio controls>
<source
src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-
1.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
h1 {
p{
.highlight {
</style>
</head>
<body>
<h1>CSS Style Types: Inline, Internal, External</h1>
</p>
<!-- Internal CSS is applied via the <style> tag in the head -->
<p class="highlight">
</p>
<p class="external-style">
</p>
</body>
</html>
4. Selector forms a. Write a program to apply different
types of selector forms i. Simple selector (element, id,
class, group, universal) ii. Combinator selector
(descendant, child, adjacent sibling, general sibling) iii.
Pseudo-class selector iv. Pseudo-element selector v.
Attribute selector
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>CSS Selectors Demonstration</title>
<style>
/* Simple Selectors */
/* Element Selector */
p{
color: green; /* Applies to all <p> elements */
}
/* ID Selector */
#main-heading {
text-align: center; /* Applies to the element with id="main-
heading" */
color: blue;
}
/* Class Selector */
.highlight {
background-color: yellow; /* Applies to elements with
class="highlight" */
font-weight: bold;
}
/* Group Selector */
h1, h2, p {
font-family: Arial, sans-serif; /* Applies to <h1>, <h2>, and <p>
elements */
}
/* Universal Selector */
*{
font-size: 16px; /* Applies to all elements on the page */
}
/* Combinator Selectors */
/* Descendant Selector */
#content p {
color: red; /* Applies to all <p> elements inside the element
with id="content" */
}
/* Child Selector */
#container > h3 {
color: purple; /* Applies only to <h3> that are direct children
of the element with id="container" */
}
/* Pseudo-class Selectors */
/* :hover pseudo-class */
a:hover {
color: red; /* Changes link color when hovered */
}
/* :nth-child pseudo-class */
li:nth-child(odd) {
background-color: #f0f0f0; /* Applies background color to
odd-numbered <li> items */
}
/* :first-child pseudo-class */
ul li:first-child {
font-size: 18px; /* Makes the first <li> larger */
}
/* Pseudo-element Selectors */
/* ::before pseudo-element */
h2::before {
content: "→ "; /* Adds an arrow before each <h2> */
color: green;
}
/* ::after pseudo-element */
p::after {
content: " (End of paragraph)"; /* Adds text after each <p> */
font-style: italic;
}
/* Attribute Selectors */
/* [attribute] selector */
a[target] {
color: blue; /* Applies style to <a> elements with a target
attribute */
}
/* [attribute="value"] selector */
input[type="text"] {
border: 2px solid green; /* Applies style to <input> elements
with type="text" */
}
</style>
</head>
<body>
<div id="container">
<h3>This is a direct child of the container</h3>
<p>This is a paragraph inside the container.</p>
</div>
<h2>This is a heading</h2>
<p>This paragraph comes after an h2 and will be styled by the
general sibling selector.</p>
<ul>
<li>Item 1 (Odd)</li>
<li>Item 2 (Even)</li>
<li>Item 3 (Odd)</li>
</ul>
</body>
</html>
6. CSS with Color, Background, Font, Text and CSS Box Model
a. Write a program to demonstrate the various ways you
can reference a color in CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Color Reference in CSS</title>
<style>
/* Color by Name */
.color-name {
background-color: blue;
color: white;
padding: 10px;
text-align: center;
margin-bottom: 10px;
}
/* Hexadecimal Color */
.hex-color {
background-color: #3498db; /* Blue */
color: white;
padding: 10px;
text-align: center;
margin-bottom: 10px;
}
/* RGB Color */
.rgb-color {
background-color: rgb(46, 204, 113); /* Green */
color: white;
padding: 10px;
text-align: center;
margin-bottom: 10px;
}
/* RGBA Color (with transparency) */
.rgba-color {
background-color: rgba(231, 76, 60, 0.7); /* Red with 70% opacity */
color: white;
padding: 10px;
text-align: center;
margin-bottom: 10px;
}
/* HSL Color */
.hsl-color {
background-color: hsl(120, 39%, 49%); /* Green */
color: white;
padding: 10px;
text-align: center;
margin-bottom: 10px;
}
<div class="color-name">
<p>This is a color defined by its name: <strong>blue</strong></p>
</div>
<div class="hex-color">
<p>This is a color defined by its hexadecimal value:
<strong>#3498db</strong></p>
</div>
<div class="rgb-color">
<p>This is a color defined by its RGB value: <strong>rgb(46, 204,
113)</strong></p>
</div>
<div class="rgba-color">
<p>This is a color defined by its RGBA value (with opacity):
<strong>rgba(231, 76, 60, 0.7)</strong></p>
</div>
<div class="hsl-color">
<p>This is a color defined by its HSL value: <strong>hsl(120, 39%,
49%)</strong></p>
</div>
<div class="hsla-color">
<p>This is a color defined by its HSLA value (with opacity):
<strong>hsla(120, 50%, 60%, 0.6)</strong></p>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Background Image Effect</title>
<style>
body {
background-image: url('https://www.example.com/your-
image.jpg'); /* Replace with your image URL */
background-position: center 50%; /* Center horizontally,
place halfway vertically */
background-attachment: fixed; /* Keeps the image fixed
when scrolling */
background-size: cover; /* Ensure the image covers the
whole screen */
transform: rotate(45deg); /* Tilt the image by 45 degrees
*/
background-repeat: no-repeat; /* Prevents the image from
repeating */
height: 2000px; /* Allows scrolling */
margin: 0;
}
h1 {
color: white;
text-align: center;
padding-top: 200px;
}
p{
color: white;
text-align: center;
}
</style>
</head>
<body>
<h1>Fixed and Tilted Background Image</h1>
<p>Scroll down to see the effect of the fixed, tilted background
image.</p>
</body>
</html>
c. Write a program using the following terms related
to CSS font and text: i. font-size ii. font-weight iv.
text-decoration v. text-transformation iii. font-style
vi. text-alignment
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>CSS Font and Text Properties</title>
<style>
/* Applying font properties and text transformations */
.font-example {
font-size: 24px; /* Font size */
font-weight: bold; /* Font weight */
font-style: italic; /* Font style */
text-decoration: underline; /* Text decoration */
text-transform: uppercase; /* Text transformation */
text-align: center; /* Text alignment */
color: #4CAF50; /* Text color */
margin: 20px;
}
.additional-example {
font-size: 18px;
font-weight: normal;
font-style: normal;
text-decoration: line-through;
text-transform: capitalize;
text-align: left;
color: #FF5722;
margin: 20px;
}
</style>
</head>
<body>
<h1 style="text-align: center;">CSS Font and Text Properties</h1>
<p class="font-example">
This is an example of applying various CSS font and text properties:
font-size, font-weight, font-style, text-decoration, text-transform, and text-
align.
</p>
<p class="additional-example">
This is another example with different text transformations and styles.
</p>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Box Model Example</title>
<style>
/* Container style for visual clarity */
.container {
width: 80%;
margin: 0 auto;
text-align: center;
}
h2 {
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h2>Understanding the CSS Box Model</h2>
<div class="box">
<p>This is a box demonstrating the CSS Box Model.</p>
<p>The content area is inside the box. Padding is the space between
content and the border. The border surrounds the padding, and the margin is
the space outside the border.</p>
</div>
<div class="box-example">
<p>This box has different padding, border, and margin values for
comparison.</p>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Internal and External JavaScript</title>
<style>
body {
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<hr>
<!-- External JavaScript File -->
<button onclick="displayExternalMessage()">Click me for External
JS</button>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>JavaScript Output Methods</title>
<style>
body {
font-family: Arial, sans-serif;
}
#output {
margin-top: 20px;
padding: 20px;
border: 1px solid #ccc;
background-color: #f9f9f9;
}
</style>
</head>
<body>
<div id="output">
<p><strong>Output will be displayed here using
innerHTML.</strong></p>
</div>
<script>
// 1. Using alert() - Displays a pop-up alert message
function showAlert() {
alert("This is an alert box showing output!");
}
</body>
</html>
#result {
margin-top: 20px;
padding: 20px;
border: 1px solid #ccc;
background-color: #f9f9f9;
}
</style>
</head>
<body>
<hr>
<hr>
<div id="result">
<h3>Output will be displayed here:</h3>
<p id="outputText"></p>
</div>
<script>
// 1. Using prompt() - Prompt the user for input through a pop-up box
function takeInputPrompt() {
let userInput = prompt("Please enter your name:");
if (userInput !== null && userInput !== "") {
document.getElementById("outputText").innerHTML = "You
entered using prompt: " + userInput;
} else {
document.getElementById("outputText").innerHTML = "No input
provided!";
}
}
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Voter Eligibility</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
table {
width: 50%;
margin-top: 20px;
border-collapse: collapse;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
padding: 10px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
.eligible {
color: green;
}
.not-eligible {
color: red;
}
</style>
</head>
<body>
<script>
// Prompt user for name and age
let voterName = prompt("Please enter your name:");
let voterAge = prompt("Please enter your age:");
</body>
</html>