HTML Lab File
HTML Lab File
&MANAGEMENT
JasanaTigoan Road, Greater Faridabad Haryana, 121006
BCA-23-205
23011312003
INDEX
INTRODUCTION TO HTML
HTML stands for Hyper Text Markup Language. It is used to design web pages using markup
language. HTML is the combination of Hypertext and Markup language. Hypertext defines the
link between the web pages. Markup language is used to define the text document within tag
which defines the structure of web pages. This language is used to annotate (make notes for the
computer) text so that a machine can understand it and manipulate text accordingly. Most of
markup (e.g. HTML) languages are human readable. Language uses tags to define what
manipulation has to be done on the text.
HTML is a markup language which is used by the browser to manipulate text, images and other
content to display it in required format. HTML was created by Tim Berners-Lee in 1991. The
first ever version of HTML was HTML 1.0 but the first standard version was HTML 2.0 which
was published in 1999.
PROGRAM - 2
AIM: Write a program to create basic table in html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic Table</title>
<style>
table {
width: 50%;
border-collapse: collapse;
th, td {
padding: 10px;
text-align: left;
th {
background-color: #333;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>Alice</td>
<td>24</td>
<td>New York</td>
</tr>
<tr>
<td>Bob</td>
<td>30</td>
<td>Los Angeles</td>
</tr>
<tr>
<td>Charlie</td>
<td>28</td>
<td>Chicago</td>
</tr>
</table>
</body>
</html>
OUTPUT:
PROGRAM – 3
AIM: Write a program to create simple event in html?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p id="message"></p>
<script>
function displayMessage() {
</script></body>
</html>
OUTPUT
PROGRAM – 4
AIM: Write a program to display date and time in html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
text-align: center;
margin-top: 20%;
#date-time {
font-size: 1.5em;
font-weight: bold;
color: #333;
</style>
</head>
<body>
<script>
function updateDateTime() {
setInterval(updateDateTime, 1000);
updateDateTime();
</script>
</body>
</html>
OUTPUT:
PROGRAM – 5
AIM: Write a program of sum operation in java script
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sum Operation</title>
</head>
<body>
<br><br>
<br><br>
<script>
function calculateSum() {
if (isNaN(num1) || isNaN(num2)) {
return;
</script>
</body>
</html>
OUTPUT:
PROGRAM – 6
AIM: Write a program to display simple animation in Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Animation</title>
<style>
.animation-container {
width: 100%;
height: 200px;
position: relative;
overflow: hidden;
background-color: #f2f2f2;
.ball {
width: 50px;
height: 50px;
background-color: #3498db;
border-radius: 50%;
position: absolute;
top: 75px;
animation: moveBall 3s linear infinite;
@keyframes moveBall {
0% {
left: 0;
50% {
100% {
left: 0;
</style>
</head>
<body>
<div class="animation-container">
<div class="ball"></div>
</div>
</body>
</html
OUTPUT:
PROGRAM – 7
AIM: Create a Program to Change Text Color Using
document.getElementById in JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script>
function changeColor() {
textElement.style.color = getRandomColor();
function getRandomColor() {
return color;
</script>
</body>
</html>
OUTPUT:
PROGRAM – 8
AIM: Write a program to display shadow in html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Shadow Effects</title>
<style>
.text-shadow {
font-size: 2em;
font-weight: bold;
color: #333;
margin: 20px;
text-align: center;
.box-shadow {
width: 200px;
height: 100px;
background-color: #3498db;
border-radius: 10px;
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 1.2em;
</style>
</head>
<body>
</body>
</html>
Output:
PROGRAM – 9
AIM: Write a program to create Array in javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p id="array-display"></p>
<script>
function addItem() {
fruits.push("Pineapple");
function removeLastItem() {
fruits.pop();
</script>
</body>
</html>
OUTPUT:
PROGRAM - 10
AIM: Write a program to display an image using HTML.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p><h3>PUP</p>
</body>
</html>
OUTPUT:
PROGRAM - 11
AIM: Write a program to create hyperlinks in HTML
<!DOCTYPE html>
<html>
<head>
<title>Hyperlink</title>
</head>
<body>
</body>
</html>
OUTPUT:
PROGRAM – 12
AIM: Write a program to create simple form in Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
.form-container {
width: 300px;
margin: 0 auto;
padding: 20px;
border-radius: 8px;
background-color: #f9f9f9;
.form-container h2 {
text-align: center;
.form-container label {
display: block;
margin-top: 10px;
}
.form-container input, .form-container textarea, .form-container button {
width: 100%;
padding: 8px;
margin-top: 5px;
border-radius: 4px;
.form-container button {
margin-top: 15px;
background-color: #4CAF50;
color: white;
cursor: pointer;
.form-container button:hover {
background-color: #45a049;
</style>
</head>
<body>
<div class="form-container">
<h2>Contact Us</h2>
<label for="email">Email:</label>
<label for="message">Message:</label>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
OUTPUT:
PROGRAM – 13
AIM: Write a program to create Image gallery in Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image Gallery</title>
<style>
.gallery {
display: grid;
gap: 15px;
padding: 20px;
.gallery img {
width: 100%;
height: auto;
border-radius: 8px;
cursor: pointer;
}
/* Hover effect on images */
.gallery img:hover {
transform: scale(1.05);
.lightbox {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
align-items: center;
justify-content: center;
.lightbox img {
max-width: 80%;
max-height: 80%;
.close-btn {
position: absolute;
top: 10px;
right: 10px;
font-size: 30px;
color: white;
background: none;
border: none;
cursor: pointer;
</style>
</head>
<body>
<div class="gallery">
</div>
<!-- Lightbox (for showing enlarged image) -->
</div>
<script>
function openLightbox(image) {
lightboxImg.src = image.src;
lightbox.style.display = "flex";
function closeLightbox() {
lightbox.style.display = "none";
</script>
</body>
</html>
OUTPUT:
PROGRAM – 14
AIM: Write a program to create navigation bar in html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Navigation Bar</title>
<style>
body {
margin: 0;
padding: 0;
.navbar {
background-color: #333;
overflow: hidden;
.navbar a {
float: left;
display: block;
color: white;
text-align: center;
text-decoration: none;
.navbar a:hover {
background-color: #ddd;
color: black;
.navbar a {
float: none;
display: block;
text-align: left;
</style>
</head>
<body>
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="#contact">Contact</a>
</div>
</body>
</html>
OUTPUT:
PROGRAM – 15
AIM: Write a program to create button in Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
.button {
.button:hover {
</style>
</head>
<body>
<script>
function displayMessage() {
</script>
</body>
</html>
OUTPUT:
PROGRAM – 16
AIM: Write a program. to use CSS in HTML
INTERNAL CSS & INLINE CSS
<!DOCTYPE html>
<html>
<head>
<style>
h1 {color: yellow;
font-family: verdana;
font-size: 300%;}
body { background-color: powderblue;}
p {color: red;}
#p01 {color: green;}
p.error {color: orange;}
</style>
</head>
<body>
<h1>CSS Stands for "Cascading Style Sheet." Cascading style sheets are used to format the
layout of Web pages.</h1><br>
<h2 style="color:blue;">CSS helps Web developers create a uniform look across several pages
of a Web site. </h2><br>
<p id="p01">If the pages all reference the same style sheet, the text size only needs to be
changed on the style sheet and all the pages will show the larger text.</p>
<p class="error">While CSS is great for creating text styles, it is helpful for formatting other
aspects of Web page layout as well. <p>
<p> CSS gives Web developers more exact control over how Web pages will look than HTML
does. </p>
</body>
</html>
OUTPUT:
EXTERNAL CSS
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>A web browser (commonly referred to as a browser) is a software application for accessing
information on the World Wide Web.</h1>
<p>When a user requests a particular website, the web browser retrieves the necessary content
from a web server and then displays the resulting web page on the user's device.</p>
</body>
</html>
STYLES.CSS
OUTPUT:
PROGRAM – 17
AIM: Write a program to show transform tag in html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
.box {
width: 200px;
height: 200px;
background-color: #4CAF50;
color: white;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
.box:hover {
</style>
</head>
<body>
<div class="box">
Hover me!
</div>
</body>
</html>
OUTPUT:
PROGRAM - 18
AIM: Write a program to print a simple message in HTML.
<!doctype html>
<html>
<head>
<head>
<body>
<p> HTML (HyperText Markup Language) is the most basic building block of the Web. It
defines the meaning and structure of web content.
Other technologies besides HTML are generally used to describe a web page's
appearance/presentation (CSS) or functionality/behavior (JavaScript).
"Hypertext" refers to links that connect web pages to one another, either within a single website
or between websites.
Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to
pages created by other people, you become an active participant in the World Wide Web. </p>
</body>
</html>
OUTPUT:
PROGRAM – 19
AIM: Write a program to formatting tags like heading tags.
<!doctype html>
<html>
<head>
</head>
<body>
<h1> HTML (HyperText Markup Language) is the most basic building block of the Web. </h1>
<h3> Other technologies besides HTML are generally used to describe a web page's
<h5> HTML consists of elements, each of which may be modified by some number of attributes.
</h5>
<h6> HTML documents are connected to each other with links. </h6>
</body>
</html>
OUTPUT
PROGRAM – 20
AIM: Write a program to formatting tags like font tags.
<!doctype html>
<html>
<head>
</head>
<body>
Hypertext Markup Language (HTML) is the standard markup language for documents designed
to be displayed in a web browser.
It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages
such as JavaScript.
Web browsers receive HTML documents from a web server or from local storage and render the
documents into multimedia web pages.
HTML describes the structure of a web page semantically and originally included cues for the
appearance of the document.
</font>
</p>
</body>
</html>
OUTPUT:
PROGRAM – 21
AIM: Write a program to create unordered lists.
<!doctype html>
<html>
<head>
<title></title>
<body>
<h2>UNORDERED LIST</h2>
<ul>
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ul><br />
<ul style="list-style-type:circle;">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ul><br>
<ul style="list-style-type:square;">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ul><br>
<ul style="list-style-type:disc;">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ul><br>
<ul style="list-style-type:none;">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ul><br>
</body>
</head>
</html>
OUTPUT:
PROGRAM – 22
AIM: Write a program to create ordered lists.
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
<h2>ORDERED LIST</h2>
<ol>
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol><br />
<ol type="A">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol><br />
<ol type="a">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol><br />
<ol type="I">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol><br />
<ol type="i">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol><br />
<ol type="1">
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol><br />
</body>
</html>
OUTPUT:
PROGRAM – 23
AIM: Write a program to create nested, description and control counting lists.
<html>
<head>
<title>Lists</title>
</head>
<body>
<ul>
<li>coffee</li>
<li>tea
<ul>
<li>black tea</li>
<li>grean tea</li>
</ul>
</li>
<li>milk</li>
</ul>
</body>
</html>
OUTPUT:
HTML DESCRIPTION LIST
<!doctype html>
<html>
<head>
<title>Lists</title>
</head>
<body>
<h2>Description List</h2>
<dl>
<dt>Coffee</dt>
<dt>Milk</dt>
</dl>
</body>
</html>
OUTPUT:
CONTROL LIST COUNTING
<!doctype html>
<html>
<head>
<title>Lists</title>
</head>
<body>
<ol start="20">
<li>tea</li>
<li>coffee</li>
<li>water</li>
</ol>
</body>
</html>
OUTPUT:
PROGRAM – 24
AIM: Write a program to create frames.
<!DOCTYPE html>
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows="40%,60%,30%">
<noframes>
<body>
</body>
</noframes>
</frameset>
</html>
OUTPUT:
PROGRAM – 25
AIM: Write a program to use various tags in HTML.
<!doctype html>
<html>
<head>
<head>
<body style="background-color:orange;">
<p> HTML (HyperText Markup Language) is the most basic building block of the Web. It
defines the meaning and structure of web content. </p>
<h4> Other technologies besides HTML are generally used to describe a web page's
appearance/presentation (CSS) or functionality/behavior (JavaScript). </h4>
</font></p>
<p style="border: 6px solid green;">In 1980, physicist Tim Berners-Lee, a contractor at CERN,
proposed and prototyped ENQUIRE, a system for CERN researchers to use and share
documents. </p>
<h3>UNORDERED LIST</h3>
<ul>
<li>coffee</li>
<li>tea</li>
</ul>
<h4>ORDERED LIST</h4>
<ol type="a">
<li>coffeed</li>
<li>milk</li>
</ol>
<a href="http://www.facebook.com" target="_blank">Facebook page</a><br>
</body>
</html>
OUTPUT:
PROGRAM – 26
AIM: Program to create a webpage using HTML
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
publicpartialclassHome : System.Web.UI.Page
{ }}
<%@PageTitle=""Language="C#"MasterPageFile="~/
MasterPage.master"AutoEventWireup="true"
CodeFile="Home.aspx.cs"Inherits="Home"%>
<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"runat="Server">
<divclass="content">
<divstyle="width:100%;height:555px;background:#eee
url('<%#ResolveUrl("~/App_Themes/Hospital/image/pattern.png") %>'); ">
<divclass="banner bh">
<divclass="container">
<divclass="slideshow"id="slideshow">
<olclass="slides">
<liclass="current"style="background-color: #ddd;">
<divclass="description">
Avail FREE consultation with our super specialists and enjoy exclusive discounts on our
services. Click here or get in touch with us at +91 88000 91958 for more information</p>
</div>
<divclass="tiltview col">
<ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/Hospitals4_Mercy.jpg") %>"/></a>
</div>
</li>
<li>
<divclass="description">
In our endeavor to providing quality healthcare to the masses at affordable costs, our teams of
doctors workhard to make you better everyday! Super specialists across multi specialties adopt
innovative techniques to ensure that patients are back to their normal routine life at the
earliest.</p>
</div>
<divclass="tiltview row">
<ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/hospital_2079352b.jpg") %>"/>
</a><ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/Patient-caring-at-Hospital.jpg")
%>"/></a>
</div>
</li>
<li>
<divclass="description">
World class health care delivered with experience, expertise and empathy.</p>
</div>
<divclass="tiltview col">
<ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/best_hospital.jpg") %>"/>
</a><ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/iStock_000009782912Large.jpg")
%>"/></a>
</div>
</li>
<li>
<divclass="description">
We ensure our cancer treatments are effective in not just eliminating the tiniest and toughest of
tumours, but also protect our patients.</p>
</div>
<divclass="tiltview col">
<ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/1a_2.jpg") %>"/>
</a><ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/max_hospital_operation1.jpg")
%>"/></a>
</div>
</li>
<li>
<divclass="description">
Six to eight patients in a cubicle and toilets in the wings of the ward, Fully-equipped Nursing
Station, Attendant Couch, Qualified dietician for diet advice and diet Service.</p>
</div>
<divclass="tiltview row">
<ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/hospital.gif") %>"/>
</a><ahref="#">
<imgsrc="<%#ResolveUrl("~/App_Themes/Hospital/image/hospital-hallway.jpg") %>"/></a>
</div>
</li>
</ol>
</div>
</div>
<scriptsrc="<%#ResolveUrl("~/App_Themes/Hospital/js/classie.js") %>"></script>
<scriptsrc="<%#ResolveUrl("~/App_Themes/Hospital/js/tiltSlider.js")
%>"type="text/javascript"></script>
<script>
new TiltSlider(document.getElementById('slideshow'));
</script>
</div>
<ul>
</div>
</div>
</div>
<divstyle="width: 100%; height: 30px; border: 1px solid #ccc; padding-top: 5px;
<marqueeloop="-1"scrollamount="3"width="100%"height="100%">
</div>
</div>
</div>
</asp:Content>
OUTPUT: