HTML Program
HTML Program
Objective: The objective of this code is to create a simple and structured web page layout for Ajay Kumar Garg
Engineering College. The page contains a few key elements aimed at presenting the college's name, a navigation
bar, and a list of engineering departments.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
body {
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
header {
background-color: #f39c12;
display: flex;
align-items: center;
padding: 10px;
.logo img {
height: 80px;
.title h1 {
flex-grow: 1;
text-align: center;
font-size: 24px;
nav {
background-color: #f1f1f1;
padding: 10px;
nav ul {
display: flex;
justify-content: space-around;
list-style-type: none;
nav ul li a {
text-decoration: none;
color: blue;
font-size: 18px;
.departments {
padding: 20px;
background-color: #fcf8e3;
.departments ul {
list-style-type: none;
font-size: 20px;
.departments ul li {
margin-bottom: 10px;
</style>
</head>
<body>
<div class="container">
<header>
<div class="logo">
</div>
<div class="title">
</div>
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Login</a></li>
<li><a href="#">Registration</a></li>
<li><a href="#">Catalogue</a></li>
<li><a href="#">Cart</a></li>
</ul>
</nav>
<section class="departments">
<ul>
<li>ECE</li>
<li>EEE</li>
<li>CIVIL</li>
<li>CSE</li>
</ul>
</section>
</div>
</body>
</html>
Output:
Experiment 02
Name: Himanshi Tomar
Objective: The objective of this code is to create a basic login page using HTML, where a user can input a
username (Login ID) and password. The page provides fields for these inputs, along with options to either
submit the form or reset the input fields. It also includes a design with some styling elements like a background
color, a base font style, and a centered image.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<html>
<head>
<style>
body {
background-color: pink;
font-size: 18px;
h1 {
color: purple;
font-size: 48px;
text-align: center;
table {
margin: 0 auto;
width: 300px;
height: 150px;
border-spacing: 15px;
input[type="text"], input[type="password"] {
width: 100%;
padding: 8px;
input[type="submit"], input[type="reset"] {
font-size: 16px;
</style>
</head>
<body>
<center>
</center>
<table>
<tr>
<td><b>Login ID:</b></td>
</tr>
<tr>
<td><b>Password:</b></td>
</tr>
<tr align="center">
</tr>
</table>
</form>
</body>
</html>
</body>
</html>
Output:
Experiment 03
Name: Himanshi Tomar
Objective: The objective of this code is to design a simple catalogue page using HTML, which lists details about
books, including the author, publisher, and price. It also provides an option to add each book to a shopping cart
through an "Add to cart" button for each item. The form action redirects to another page when the "Add to cart"
button is clicked.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<html>
<head>
<title>Catalogue</title>
<style>
body {
background-color: pink;
table {
width: 100%;
border-collapse: collapse;
td {
padding: 10px;
vertical-align: middle;
text-align: left;
img {
display: block;
margin: auto;
.book-info {
padding-left: 10px;
.price {
text-align: center;
input[type="submit"] {
background-color: purple;
color: white;
border: none;
cursor: pointer;
</style>
</head>
<body>
<table border="1">
<tr>
<td>
</td>
<td class="book-info">
</td>
<td class="price">
</td>
<td>
<form action="order.html">
</form>
</td>
</tr>
<tr>
<td>
</td>
<td class="book-info">
<b>Publication:</b> PEARSON
</td>
<td class="price">
</td>
<td>
<form action="order.html">
</form>
</td>
</tr>
</table>
</body>
</html>
</body>
</html>
Output:
Experiment 04
Name: Himanshi Tomar
Objective: The objective of this set of HTML pages is to design a cart page and other related category pages for
an online bookstore, where users can select and view books from various engineering fields, choose quantities,
and see a breakdown of costs including shipping. It simulates the functionality of adding books to a cart for
purchase and provides some information about specific categories like Computer Science, Electronics, and
Mechanical Engineering.
Code:
<html>
<head>
<style>
body {
background-color: lightgray;
h1 {
color: blue;
text-align: center;
nav {
background-color: darkblue;
color: white;
padding: 10px;
text-align: center;
nav a {
color: white;
text-decoration: none;
margin: 0 15px;
font-size: 18px;
section {
margin-top: 20px;
.section-container {
background-color: cyan;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
.book-info {
padding-left: 10px;
table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
table, td {
td {
padding: 10px;
input[type="submit"] {
background-color: purple;
color: white;
border: none;
</style>
</head>
<body>
<nav>
<a href="#CSE">CSE</a>
<a href="#ECE">ECE</a>
<a href="#EEE">EEE</a>
<a href="#MECH">Mechanical</a>
</nav>
<table align="center">
<tr>
<td>Text Books</td>
<td>
<select name="book">
<option value="C&Ds">C&Ds</option>
<option value="Ads">Ads</option>
<option value="Java">Java</option>
<option value="Oracle">Oracle</option>
<option value="MySql">MySql</option>
</select>
</td>
</tr>
<tr>
<td>Quantity</td>
Output:
Experiment 05
Name: Himanshi Tomar
Objective: The objective of this code is to design a registration page using HTML that collects user information
such as name, password, email, phone number, gender, and address. The form allows users to input these details
and provides options to submit or reset the data.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Registration Form</title>
</head>
<body>
<style>
body {
background-color: #91afc4;
text-align: center;
h1 {
color: blue;
text-align: center;
.required {
color: red;
</style>
<h1>Registration Form</h1>
<form action="right.html" method="POST">
<label for="firstname"
<br />
<input
type="text"
id="firstname"
name="firstname"
required
minlength="6" />
<br />
<br />
<small class="required">
<br />
<input
type="password"
id="pass"
name="pass"
required
minlength="6" />
<br />
<label>Gender:</label><br />
</form>
</body>
</html>
Output:
Experiment 06
Name: Himanshi Tomar
Objective: The objective of this code is to create a registration form with client-side validation using JavaScript.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Registration Form</title>
</head>
<body>
<style>
body {
background-color: #91afc4;
text-align: center;
h1 {
color: blue;
text-align: center;
.required {
color: red;
}
.error {
color: red;
font-size: 12px;
</style>
<h1>Registration Form</h1>
<label for="firstname">
</label>
<br />
<br />
<br />
<small class="required"><br>
</small>
<br />
<br />
<br />
<label>Gender:</label><br />
</form>
<script>
if (firstName.length < 6) {
valid = false;
valid = false;
// Email validation
if (!emailPattern.test(email)) {
valid = false;
// Password validation
valid = false;
// Address validation
valid = false;
valid = false;
if (!valid) {
event.preventDefault();
});
</script>
</body>
</html>
Output: