Lab Manual Waqas Bhatti
Lab Manual Waqas Bhatti
Lab Manual Waqas Bhatti
Name:
Waqas Bhatti
Roll No:
73
Submitted To:
Mam DurdanaRehman
MNS University of Engineering and
Technology Multan
Introduction:
What is HTML ?
HTML Stand for Hyper Text markup Language. HTML is the standard markup Language for
creating Web pag.HTML elements are the building blocks of HTML page.
Structural Tags:-
<HTML>
</html>
<head>
</head>
<title>
<html>
<head>
</head>
<body>
</body>
</html>
Header Tags:
HTML headings are titles or subtitles that you want to display on a webpage.
<html>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
This paragraph
contains a lot of lines
in the source code,
but the browser
ign<p>
ores it.
</p>
<br>
<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
This paragraph contains a lot of lines in the source code, but the browser ignores it.
This paragraph contains a lot of spaces in the source code, but the browser ignores it.
The number of lines in a paragraph depends on the size of the browser window. If you resize the
browser window, the number of lines in this paragraph will change.
Horizontal Rule:-
<html>
<body>
</body>
</html>
The HTML <b> element defines bold text, without any extra importance.
The HTML <strong> element defines text with strong importance. The content
inside is typically displayed in bold.
The <i> tag is often used to indicate a technical term, a phrase from another
language, a thought, a ship name, etc.
<p>This text is normal.</p> This text is normal.
The HTML <em> element defines emphasized text. The content inside is
typically displayed in italic.
The HTML <mark> element defines text that should be marked or highlighted:
The HTML <del> element defines text that has been deleted from a document.
Browsers will usually strike a line through deleted text:
The HTML <ins> element defines a text that has been inserted into a
document. Browsers will usually underline inserted text:
The HTML <sup> element defines superscript text. Superscript text appears
half a character above the normal line, and is sometimes rendered in a
smaller font. Superscript text can be used for footnotes, like WWW [1]:
HTML Styles
The HTML style attribute is used to add styles to an element, such as color,
font, size, and more.
ody style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
This is a heading
</body> This is a paragraph.
</html>
This is a paragraph.
The HTML <blockquote> element defines a section that is quoted from another
source.
<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 60 years, WWF has worked to help people and nature thrive. As the
world's leading conservation organization, WWF works in nearly 100
countries. At every level, we collaborate with people around the world to
develop and deliver innovative solutions that protect communities, wildlife,
and the places in which they live.
</blockquote>
For 60 years, WWF has worked to help people and nature thrive. As the world's leading
conservation organization, WWF works in nearly 100 countries. At every level, we
collaborate with people around the world to develop and deliver innovative solutions that
protect communities, wildlife, and the places in which they live.
HTML <q> for Short Quotations
The HTML <q> tag defines a short quotation.
Marking up abbreviations can give useful information to browsers, translation systems and
search-engines.
The HTML <address> tag defines the contact information for the author/owner
of a document or an article.
<address>
Visit us at:<br>
Example.com<br>
USA
</address>
The HTML address element defines contact information (author/owner) of a document or article.
The HTML <cite> tag defines the title of a creative work (e.g. a book, a poem,
a song, a movie, a painting, a sculpture, etc.).
The HTML <bdo> tag is used to override the current text direction:
<html>
<body>
<p>If your browser supports bi-directional override (bdo), the next line will
be written from right to left (rtl):</p>
</body>
</html>
If your browser supports bi-directional override (bdo), the next line will be written from right to
left (rtl):
You can add comments to your HTML source by using the following syntax:
<html>
<body>
This is a paragraph to
</body>
</html>
HTML Colors
HTML colors are specified with predefined color names, or with RGB, HEX,
HSL, RGBA, or HSLA values.
Tomato
Orange
DodgerBlue
MediumSeaGreen
Gray
SlateBlue
Violet
<body>
<p style="background-color:Tomato;">
</p>
</body>
</html>
Hello World
What is CSS?
With CSS, you can control the color, font, the size of text, the spacing
between elements, how elements are positioned and laid out, what
background images or background colors are to be used, different displays
for different devices and screen sizes, and much more!
Using CSS
Inline CSS
<html>
<body>
</body>
A red paragraph
Internal CSS
<html>
<head>
<style>
h1 {color: blue;}
This is a heading
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External CSS
An external style sheet is used to define the style for many HTML pages.
To use an external style sheet, add a link to it in the <head> section of each
HTML page:
<html>
<head>
</head>
<p>This is a paragraph.</p>
</body>
</html>
HTML Links
Links are found in nearly all web pages. Links allow users to click their way
from page to page.
When you move the mouse over a link, the mouse arrow will turn into a little
hand.
The HTML <a> tag defines a hyperlink. It has the following syntax:
Example:-
<html>
<body>
<h1>HTML Links</h1>
<p><a href="https://www.w3schools.com/">Visit
W3Schools.com!</a></p>
</body>
</html> HTML Links
Visit W3Schools.com!
Example
<a href="https://www.w3schools.com/" target="_blank">Visit W3Schools!</a>
Visit W3Schools!
Both examples above are using an absolute URL (a full web address) in
the href attribute.
A local link (a link to a page within the same website) is specified with
a relative URL (without the "https://www" part):
Example
<img src="img_girl.jpg" alt="Girl in a jacket">
HTML Image
HTML Favicon
A favicon is a small image displayed next to the page title in the browser tab.
Example
<html>
<head>
<title>My Page Title</title>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
</head>
<body>
<p>This is a paragraph.</p>
</body>
</html>
HTML Table
A table in HTML consists of table cells inside rows and columns.
<html>
<style>
table, th, td {
</style>
<body>
<table style="width:100%">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
</body>
</html>
HTML Lists
HTML lists allow web developers to group a set of related items in lists.
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
The list items will be marked with bullets (small black circles) by default:
<html>
<body>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
<html>
<body>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
1. Coffee
2. Tea
3. Milk
<htm>
<head>
<body>
<center>
<h3>INSTRUCTIONS <h3>
</center>
<ol type="1">
<li>the Application form complete in all respect should the office of the Resgister. Not
later then the due date.<br>
incomplete Application form or those recevid later the due date will not be
entertained<br></li>
</ol>
<p style="float:right;"> <img src="pic" width="200" height="200"
title="PHOTOGRAPH" alt="PHOTOGRAPH"> </p>
<ol type="1">
<li>Name of
applicant..............................................................................................................<br></
li>
.................................................................................................................................... <br
></li>
<li>Father,s
Name...................................................................................................................<br></
li>
<li>present
address..................................................................................................................<br></
li>
<li>Ph No:.......................................................mobile
no...........................................................<br></li>
<li>Permanent
address................................................................................................................<br></
li>
<li>ph no:........................................................mobile
no..........................................................<br></li>
<li>Academic Qualication:</li>
<table border="2">
<tr>
<th>institution <br>attended</th>
<th>subject <br>student</th>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr><tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br><br>
<table border="1">
<tr>
<th>Dates<br> Form:.....To</th>
</tr>
<tr>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<br><br>
<table border="1">
<tr>
<td width="100"> </td>
<td width="100"></td>
<td width="100"></td>
<tr>
<div>
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>London has over 13 million inhabitants.</p>
</div>
<td > </td>
<td ></td>
<td ></td>
<td ></td>
</tr>
<tr>
<td> </td>
<td ></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td ></td>
<td ></td>
<td></td>
</tr>
<tr>
<td> </td>
<td ></td>
<td ></td>
<td></td>
</tr>
<tr>
<td> </td>
<td></td>
<td ></td>
<td></td>
</tr>
<tr>
<td> </td>
<td ></td>
<td ></td>
<td></td>
</tr>
</table>
</ol>
<p style="float:left;"><b>Declarationl</b></p>
<p style="float:left;">solemnly declare that the information given in the Form is correct. in
case,any part of date<br>
the given information in find wrong. i shall be liable to disciplinary actuion and dismissal<br>
form service.</p>
<p style="float:left;">Date.....................
<p>...................signature of applicant
</p>
</body> </html>
INSTRUCTIONS
Name of grad/division
Your of institution subject
Examination with
passed attended student
passed mark obtained
Declarationl
solemnly declare that the information given in the Form is correct. in case,any part of date
the given information in find wrong. i shall be liable to disciplinary actuion and dismissal
form service.
Date.....................
...................signature of applicant
<div>
<h2>Oslo</h2>
<p>Oslo is the capital city of Norway.</p>
<p>Oslo has over 600.000 inhabitants.</p>
</div>
<div>
<h2>Rome</h2>
<p>Rome is the capital city of Italy.</p>
<p>Rome has almost 3 million inhabitants.</p>
</div>
Output:-
London
Oslo
Rome
HTML Forms
An HTML form is used to collect user input. The user input is most often sent
to a server for processing.
The HTML <form> element is used to create an HTML form for user input:
The <form> element is a container for different types of input elements, such
as: text fields, checkboxes, radio buttons, submit buttons, etc.
Type Description
Text Fields
The <input type="text"> defines a single-line input field for text input.
<html>
<body>
<form>
</form>
<p>Also note that the default width of text input fields is 20 characters.</p>
</body>
</html>
First name:
J ohn
Last name:
Doe
Also note that the default width of text input fields is 20 characters.
The <label> element is useful for screen-reader users, because the screen-
reader will read out loud the label when the user focuses on the input
element.
The <label> element also helps users who have difficulty clicking on very small
regions (such as radio buttons or checkboxes) - because when the user clicks
the text within the <label> element, it toggles the radio button/checkbox.
The for attribute of the <label> tag should be equal to the id attribute of
the <input> element to bind them together.
Radio Buttons
<html>
<body>
<h2>Radio Buttons</h2>
<form>
<label for="html">HTML</label><br>
<label for="css">CSS</label><br>
<label for="javascript">JavaScript</label>
</form>
</body>
</html>
Radio Buttons
HTML
CSS
JavaScript
HTML Input Types
Here are the different input types you can use in HTML:
<input type="button">
<input type="checkbox">
<input type="color">
<input type="date">
<input type="datetime-local">
<input type="email">
<input type="file">
<input type="hidden">
<input type="image">
<input type="month">
<input type="number">
<input type="password">
<input type="radio">
<input type="range">
<input type="reset">
<input type="search">
<input type="submit">
<input type="tel">
<input type="text">
<input type="time">
<input type="url">
<input type="week">
<html>
<body>
<h2>Text field</h2>
<p>The <strong>input type="text"</strong> defines a one-line text input
field:</p>
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
<p>Note that the form itself is not visible.</p>
<p>Also note that the default width of a text field is 20 characters.</p>
</body>
</html>
Text field
The input type="text" defines a one-line text input field:
First name:
Last name:
Submit
<html>
<head>
Login Page
</title>
<style>
form{
background: green;
width: 370;
margin:auto;
border-radius: 30px;
padding-left: 40;
padding-botton: 10
.container{
margin-left: 10;
button{
width:49%;
border-radius: 25px;
</style>
</head>
<body bgcolor="PINK";>
<form action="text">
<br>
Name="Username"placeholder="type
Password<br><input type="Password"
name="password" placeholder="type
your password">
<br><br>
<br>
<br>
<br>
</body>
</html>
CSS Introduction:-
Example
In this example all <p> elements will be center-aligned, with a red text
color:
p{
color: red;
text-align: center; Hello World!
These paragraphs are styled with CSS.
}
<html>
<head>
<style>
h1 {
background-color: green;
}
div {
background-color: lightblue;
}
p {
background-color: yellow;
}
</style>
</head>
<body>
</body>
</html>
Result:
A dotted border.
A dashed border.
A solid border.
A double border.
No border.
A hidden border.
A mixed border.
CSS Margins
The CSS margin properties are used to create space around elements, outside
of any defined borders.
With CSS, you have full control over the margins. There are properties for
setting the margin for each side of an element (top, right, bottom, and left).
CSS has properties for specifying the margin for each side of an element:
margin-top
margin-right
margin-bottom
margin-left
CSS has properties for specifying the padding for each side of an element:
padding-top
padding-right
padding-bottom
padding-left
<html>
<head>
<style>
div {
background-color: lightblue;
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
</style>
</head>
<body>
</body>
</html>
<html>
<head>
<style>
div {
background-color: lightblue;
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
</style>
</head>
<body>
</html>
<html>
<head>
<style>
p {outline-color:red;}
</style>
</head>
<body>
<h2>The outline-style Property</h2>
<p class="groove">A groove outline. The effect depends on the outline-color value.</p>
<p class="ridge">A ridge outline. The effect depends on the outline-color value.</p>
<p class="inset">An inset outline. The effect depends on the outline-color value.</p>
<p class="outset">An outset outline. The effect depends on the outline-color value.</p>
</body>
</html>
CSS Fonts
CSS Icons
CSS Links
<html>
<head>
<style>
a{
Style a link with a color
color: hotpink;
This is a link
}
</style>
</head>
<body>
</body>
</html>
Table Borders
The example below specifies a solid border for <table>, <th>, and <td>
elements:
Firstname Lastname
Peter Griffin
Lois Griffin
CSS Layout - The display Property
The display property is the most important CSS property for controlling layout.
Every HTML element has a default display value, depending on what type of
element it is. The default display value for most elements is block or inline.
The display property is used to change the default display behavior of HTML
elements.
Block-level Elements
A block-level element ALWAYS starts on a new line and takes up the full
width available (stretches out to the left and right as far as it can).
<div>
<h1> - <h6>
<p>
<form>
<header>
<footer>
<section>
<html>
<head>
<style>
li {
display: inline;
</style>
</head> HTML
<body>
<ul> CSS
</ul>
The position property specifies the type of positioning method used for an
element.
static
relative
fixed
absolute
sticky
<style>
div.static {
position: static;
position: static;
border: 3px solid #73AD21;
An element with position: static; is not positioned in any special
} way; it is always positioned according to the normal flow of the
page:
</style>
<body>
<h2>position: static;</h2>
<p>An element with position: static; is not positioned in any special way; it is always positioned
according to the normal flow of the page:</p>
<div class="static">
</div>
</body>
</html>
<style>
div.fixed {
position: fixed;
bottom: 0;
right: 0;
width: 300px;
</style>
</head>
<body>
<h2>position: fixed;</h2>
<p>An element with position: fixed; is positioned relative to the viewport, which means it
always stays in the same place even if the page is scrolled:</p>
<div class="fixed">
</div>
</body>
</html>
The CSS clear property specifies what elements can float beside the cleared
element and on which side.
<html>
<head>
<style>
img {
float: right;
</style>
</head>
<body>
<h2>Float Right</h2>
<p>In this example, the image will float to the right in the paragraph, and the text in the
paragraph will wrap around the image.</p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum
interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl
est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet.
Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus
interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim
ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida
venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.
Cras ac leo purus. Mauris quis diam velit.</p>
</body>
</html>
CSS Pseudo-classes
<head>
<style>
/* unvisited link */
a:link {
color: red;
/* visited link */
a:visited {
color: green;
a:hover {
color: hotpink;
}
Styling a link depending on state
/* selected link */ This is a link
a:active { Note: a:hover MUST come after a:link and a:visited in the CSS definition in
order to be effective.
color: blue;
Note: a:active MUST come after a:hover in the CSS definition in order to be
}
effective.
</style>
</head>
<body>
<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to
be effective.</p>
<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be
effective.</p>
</body>
</html>
CSS Pseudo-elements
Syntax
selector::pseudo-element {
property: value;
} You can use the ::first-line pseudo-element to add a special
<html> effect to the first line of a text. Some more text. And even more,
and more, and more, and more, and more, and more, and
<head>
more, and more, and more, and more, and more, and more.
<style>
p::first-line {
color: #ff0000;
font-variant: small-caps;
</style>
</head>
<body>
<p>You can use the ::first-line pseudo-element to add a special effect to the first line of a text.
Some more text. And even more, and more, and more, and more, and more, and more, and
more, and more, and more, and more, and more, and more.</p>
</body>
</html>
Navigation Bars
With CSS you can transform boring HTML menus into good-looking
navigation bars.
In our examples we will build the navigation bar from a standard HTML list.
A navigation bar is basically a list of links, so using the <ul> and <li>
elements makes perfect sense:
Example
<html>
<body>
Home
<ul> News
Contact
<li><a href="#home">Home</a></li> About
<li><a href="#news">News</a></li>
Note: We use href="#" for test links. In a real web site
this would be URLs.
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
<p>Note: We use href="#" for test links. In a real web site this would be URLs.</p>
</body>
</html>
Home
One way to build a horizontal navigation bar is to specify the <li> elements
as inline, in addition to the "standard" code from the previous page:
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
display: inline;
Hohe News Contacts About
}
</style>
</head>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>