Muhammad Aamir 2023 CS 566
Muhammad Aamir 2023 CS 566
Lahore,Narowal Campus
(UET)
Lab Manual
Website:
A website is a collection of interlinked web pages with a common domain name. The website
can be made by any individual, group, or company. All the websites together constitute the world
wide web.
The website can be of several types, like an e-commerce website, social media website, or a blog
website, and every website has a different role, but one thing is common that every website has
several linked web pages.
The <!DOCTYPE html> declaration defines that this document is an HTML document
The <html> element is the root element of an HTML page
The <head> element contains meta information about the HTML page
The <title> element specifies a title for the HTML page (which is shown in the browser's
title bar or in the page's tab)
The <body> element defines the document's body, and is a container for all the visible
contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
An HTML element is defined by a start tag, some content, and an end tag:
The HTML element is everything from the start tag to the end tag:
Text Formattjng:
In Text formattjng we have P, B, I, Strong, Big, Em, Small, Sub, Sup
We can write program.
<!DOCTYPE html>
<html>
<head>
<title> Formattjng Page </title>
</head>
<body style="background-color: aqua;">
</body>
</html>
Output:
Text Alignment:
<!DOCTYPE html>
<html>
<head>
<title> Text Alignment</title>
</head>
<body>
Output:
Output:
Hyperlink in HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
<a href="www.google">Google</a>
</body></html>
Output:
Hyperlink in HTMT:
<html>
<body>
company</font></b></h1>
href="about.htm">About</a></font></b></p>
href="product.htm">Product</a></font></b></p>
href="contact.htm">Contact</a></font></b></p>
</body>
</html>
OUTPUT:
IMAGES IN HTML
<html>
<body>
<img src="myimage.jpg" tjtle="This is my fmowers image" alt="This is my image" align="top"
width="300" height="300"/>
</body>
</html>
OUTPUT:
Tables in Html:
HTML tables enable to efgectjvely present large amounts of data in rows and
columns.
Table Structure
A table is basically a rectangle containing rows and columns. The places where the
columns and
rows intersect are called cells. Each cell can hold Web page content.
Cell Spanning
Cells can span two or more columns or rows to form bigger containers for data.
For example, a table may include a tjtle cell at the top that spans multjple columns
across the table, or one that extends downward across several rows.
Table Elements
Tables are defjned with the <table> tag.
A table is divided into rows with the <tr> tag, and each row is divided into data
cells with the <td> tag. The <td> stands for "table data," which is the content of a
data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal
rules, tables, etc.
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
<body>
<tr>
<th>Name</th>
<th>Address</th>
<th>City</th>
</tr>
<tr>
<td>Umar</td>
<td>Multan</td>
<td>Multan</td>
</tr>
</body>
</body></html>
Output:
FORMS IN HTML:
A form allows a user to enter data that is sent to a server for processing. It is a
sectjon of a document containing normal content, markup, special elements
called controls (checkboxes, radio butuons, menus, etc.), and labels on those
controls.
The most important form element is the input element. It is used to select user
informatjon. It can vary in many ways, depending on the type aturibute and can
be
of type text fjeld, checkbox, password, radio butuon, submit butuon, and more.
<form>
Input element
</form>
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
<form actjon=“ ">
First name: <input type="text" name="fjrstname"><br>
Last name: <input type="text" name="lastname">
</form>
</body></html>
OUTPUT:
Password Filled
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
<form actjon=“ ">
Username: <input type="text" name="user"><br>
Password: <input type="password" name="password">
</form>
</body></html>
OUTPUT:
Checkbox :
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
<form action="">
<input type="checkbox" name="myclass" value="web">Web Engineering<br>
<input type="checkbox" name="myclass" value="CS">Computer Science
</form>
</body>
</html>
Output:
Radio Button:
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
<form action="">
<input type="radio" name="myradio" value="male">Male<br>
<input type="radio" name="myradio" value="female">Female
</form>
</body>
</html>
Output:
Form Drop down:
<!DOCTYPE html>
<html lang="en">
<head>
<title>page</title>
</head>
<body>
</body>
<form actjon=””>
<select name=”Subject”>
<optjon value=”web”>Web Engineering</optjon>
<optjon vale=”pm”>Project Management</optjon>
<optjon value=”cs”>Computer Science</optjon>
<optjon value=”c++”>C++>/optjon>
</select>
</form>
</html>
Output:
Output:
Output:
Output:
CSS (Cascading Style Sheets)
Introductjon
• A language that use to defjne styles against any HTML element.
• CSS stands for cascading style sheet.
• CSS describes how HTML elements are to be displayed on screen, paper, or
in other media.
• CSS saves a lot of work. It can control the layout of multjple web pages all
at once.
• External stylesheets are stored in CSS fjles.
• HTML was NEVER intended to contain tags for formattjng a web page!
• <h1>This is a heading</h1>
• <p>This is a paragraph.</p>
• When tags like <font>, and color atuributes were added to the HTML 3.2
large websites, where fonts and color informatjon were added to every
• To solve this problem, the World Wide Web Consortjum (W3C) created CSS.
CSS Syntax:
The Style sheets are made up of rules. Each rule has three parts
Selector (body) -tells the browser which part of the document is afgected by the
rule
layout is
being set
Value (Color name or color number) the value for the style property
semicolons.
colon.
• A CSS declaratjon always ends with a semicolon, and declaratjon blocks are
<html>
<head>
<style>
p{
color: red;
text-align: center;
</style>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
Output:
CSS
Example (with a Navigatjon bar)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<tjtle>Introductjon to CSS</tjtle>
<style type="text/css">
body {
font-family: Georgia, "Times New Roman", Times, serif;
color: purple;
background-color: #d8da3d
}
h1 {
font-family: century gothic, Geneva, Arial, SunSans-Regular, sans-serif }
</style>
</head>
<body>
<ul class="navbar">
<li><a href="index.html">Home page</a>
<li><a href="product.html">Product</a>
<li><a href="services.html">Services</a>
<li><a href="contact.html">Contact</a>
</ul>
<h1>kaims Instjtute </h1>
<p>Welcome to our instjtute</p>
<p><h3>The Department of Electronic & Computer Systems Engineering</h3></p>
</body>
</html>
OUTPUT:
CSS Links
A:link
Defjnes the style for normal unvisited links.
A:visited
Defjnes the style for visited links.
A:actjve
Defjnes the style for actjve links.
A link becomes actjve once you click on it.
A:hover
Defjnes the style for hovered links.
A link is hovered when the mouse moves over it.
CSS
Link-Underline
<style type="text/css">
A:link {text-decoratjon: none}
A:visited {text-decoratjon: none}
A:actjve {text-decoratjon: none}
A:hover {text-decoratjon: underline; color: red;}
</style><a href="">kaims</a>
Underline/Overline
<style type="text/css">
A:link {text-decoratjon: none}
A:visited {text-decoratjon: none}
A:actjve {text-decoratjon: none}
A:hover {text-decoratjon: underline overline; color: red;}
</style><a href="">kaims</a>
Lab 26
CSS List
list-style type
Defjnes the look of the bullets used in the list
list-style image
custom graphic for bullets
list-style positjon
Ofen the text in a list is longer than one line.
list-style positjon:outer
lets the second line align with the fjrst line. That is: the
bullet is to the lef of both lines.
list-style positjon:inner
lets the second line align with the bullet.
CSS
Layers
Pieces of HTML that are placed on top of the regular page with pixel
precision
To create a layer assign the positjon aturibute to the style
The positjon itself is defjned with the top and lef propertjes
The lef and top propertjes defjnes the exact positjon of the layer
The Top layer is defjned with the z-index aturibute
positjon:absolute
If the positjon is absolute it will be calculated from the upper lef corner of the
page - unless the layer is defjned inside another layer, in which case it will be
calculated from the upper lef corner of the parent layer.
positjon:relatjve
If the positjon is relatjve it will be relatjve to the positjon of the tag that carries the
style.
Hidden Layer
visibility property that allow to create invisible layers.
<div style="positjon:relatjve; visibility:hidden;">NFC IET</div>
<head>
<body>
<div style="background-color:green;
width:100px;
height:100px;
positjon:relatjve;
top:10px;
lef:80px;
z-index:2;">
</div>
<div style="background-color:blue;
width:100px;
height:100px;
positjon:relatjve;
top:-60px;
lef:35px;
z-index:1;">
</div>
</body>
</html>
OUTPUT:
The CSS box model is essentially a box that wraps around every HTML element. It consists of:
content, padding, borders and margins. The image below illustrates the box model:
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
The box model allows us to add a border around elements, and to define space between
elements.
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightgrey;
width: 300px;
border: 15px solid green;
padding: 50px;
margin: 20px;
}
</style>
</head>
<body>
<h2>Demonstrating the Box Model</h2>
<p>The CSS box model is essentially a box that wraps around every HTML element. It
consists of: borders, padding, margins, and the actual content.</p>
<div>This text is the content of the box. We have added a 50px padding, 20px margin and
a 15px green border. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</body>
</html>
OUTPUT:
HOTEL WEBSITE:
LOGIN PAGE SOURCE CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LOGIN IN PAGE </title>
</head>
<style>
body{
background-image:url(sign\ in.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 80% 100%;
}
</style>
<body>
<!-- header -->
<header>
<a href="#">LOGIN</a>
<a href="signup.html">SIGNUP</a>
</header>
<!-- login in form -->
<h1 style="color: brown;">
Login In Your Account
</h1>
<h2 style="color:red ;">LOG IN</h2>
<form action="">
<a href="login.html">LOGIN</a>
<a href="#">SIGNUP</a>
</header>
<!-- registeration form -->
<h1 style="color: greenyellow;" >
Register Your Self
</h1>
<h2 style="color:red;">SIGN UP</h2>
<form action="">
<label for="name" style="color:red;">NAME</label>
<input id="name" type="text" placeholder="Type Your Name"><br>
<label for="name" style="color: red;">EMAIL</label>
<input id="name " type="email" placeholder="Type Your Email"><br>
<label for="name" style="color: red;" >PASSWORD</label>
<input id="name" type="password" placeholder="Type your
PASSWORD"><br>
<label for="name" style="color: red;">CONFIRM PASSWORD</label>
<input id="name" type="password" placeholder="Type password again">
<br>
<button style="color: blue;">
Submit
</button>
</form>
<h3 style="color:brown;">
Alreday have an account <b>?</b> click here to <a href="login.html">
login</a>
</h3>
<br><br>
<!-- footer -->
<footer style="color: brown;">
All Right Reserved 2023
</footer>
</body>
</html>
OUTPUT:
FRONT PAGE CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>hotel booking</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="header">
<a href="image.jpg" id="logo"><img src="image.jpg" style="border-radius:
50%;" alt="" ></a>
<nav class="navbar">
<a href="homepage.html">home</a>
<a href="about-us.html">about us</a>
<a href="login.html">Login</a>
<a href="booking.html">bookings</a>
<a href="contact-us.html">contact</a>
</nav>
<div class="icons">
</header>
<!-- background image -->
<div class="main-background">
<div class="main-text">
<h2 style="color:white;">Scholar's Haven Hotel</h2>
</div>
</div>
<!-- background image ended -->
<div class="award-winning-hotel">
<h1>award <span>winning</span> hotels</h1>
<div class="main-hotel">
<div class="inner-award">
<img src="imgaes/award1.png" alt="">
<h2>middle town</h2>
<p>We fill the space content. High-quality, beautiful, solid and
pleasant to the touch. Furniture and decoration of concrete? You to us.</p>
</div>
<div class="inner-award">
<img src="imgaes/award 2.png" alt="">
<h2>middle town</h2>
<p>We fill the space content. High-quality, beautiful, solid and
pleasant to the touch. Furniture and decoration of concrete? You to us.</p>
</div>
<div class="inner-award">
<img src="imgaes/award 3.png" alt="">
<h2>middle town</h2>
<p>We fill the space content. High-quality, beautiful, solid and
pleasant to the touch. Furniture and decoration of concrete? You to us.</p>
</div>
<div class="inner-award">
<img src="imgaes/award4.png" alt="">
<h2>middle town</h2>
<p>We fill the space content. High-quality, beautiful, solid and
pleasant to the touch. Furniture and decoration of concrete? You to us.</p>
</div>
<div class="inner-award">
<img src="imgaes/award5.png" alt="">
<h2>middle town</h2>
<p>We fill the space content. High-quality, beautiful, solid and
pleasant to the touch. Furniture and decoration of concrete? You to us.</p>
</div>
<div class="inner-award">
<img src="imgaes/award6.png" alt="">
<h2>middle town</h2>
<p>We fill the space content. High-quality, beautiful, solid and
pleasant to the touch. Furniture and decoration of concrete? You to us.</p>
</div>
</div>
</div>
<!-- award winning ended -->
<!-- roomes -->
<div class="our-rooms">
<h1>Our <span>rooms</span></h1>
<div class="inner-rooms">
<div class="room-box">
<img src="imgaes/award1.png" alt="">
<div class="beds">
<span>1 bed</span><i class="fas fa-bed"></i>
</div>
<div class="book-room-btn">
<a href="#" class="book-room">Book now</a>
</div>
</div>
<div class="room-box">
<img src="imgaes/award1.png" alt="">
<div class="beds">
<span>1 bed</span><i class="fas fa-bed"></i>
</div>
<div class="book-room-btn">
<a href="#" class="book-room">Book now</a>
</div>
</div>
<div class="room-box">
<img src="imgaes/award1.png" alt="">
<div class="beds">
<span>1 bed</span><i class="fas fa-bed"></i>
</div>
<div class="book-room-btn">
<a href="#" class="book-room">Book now</a>
</div>
</div>
</div>
</div>
<div class="gallery">
<h1>Our <span>gallery</span></h1>
<div class="main-gallery">
<div class="inner-gallery">
<img src="imgaes/award1.png" alt="">
</div>
<div class="inner-gallery">
<img src="imgaes/award1.png" alt="">
</div>
<div class="inner-gallery">
<img src="imgaes/award1.png" alt="">
</div>
<div class="inner-gallery">
<img src="imgaes/award1.png" alt="">
</div>
<div class="inner-gallery">
<img src="imgaes/award1.png" alt="">
</div>
<div class="inner-gallery">
<img src="imgaes/award1.png" alt="">
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
OUTPUT:
</head>
<style>
body{
background-image:url(all.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style>
<body>
<!-- header -->
<header>
<a href="#">HOME</a>
<br>
<video width="320" height="240" controls autoplay muted>
<source src="simple.mp4" >
</video>
</body>
</html>
OUTPUT:
BOOKING PAGE CODE:
<!DOCTYPE html>
<html>
<head>
<title>Booking</title>
<style>
.test2{
color:white;
}
</style>
</head>
<style>
body{
background-image:url(hotebook.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
h1{
border-width: 3px;
border-style: dashed;
width:200px;
height: 100px;
text-align: center;
}
</style>
<body>
<header>
<a href="#"></a>
</header>
<h1 style="text-align:center; color: blue;" id1="name" >Room Booking</h1>
<form action="booking_process.php" method="post" style="color:red ;">
<label for="name" >Name:</label>
<input type="text" id="name" name="name"placeholder="Type Your NAME"
required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" placeholder="Type Your Email"
required><br><br>