HTML Practical File
HTML Practical File
HTML Practical File
Objectives:
By the end of this workshop, you will be able to:
Prerequisites:
You will need a text editor, such as Notepad and an Internet browser, such as Internet Explorer or Netscape.
A: Notepad is the default Windows text editor. On most Windows systems, click your Start button and choose
Programs then Accessories. It should be a little blue notebook.
Mac Users: SimpleText is the default text editor on the Mac. In OSX use Text Edit and change the following
preferences: Select (in the preferences window) Plain text instead of Rich text and then select Ignore rich text
commands in HTML files. This is very important because if you don't do this HTML codes probably won't work.
One thing you should avoid using is a word processor (like Microsoft Word) for authoring your HTML
documents.
The markup tags tell the Web browser how to display the page
HTML Tags
HTML tags are surrounded by the two characters < and >
The surrounding characters are called angle brackets
The first tag in a pair is the start tag, the second tag is the end tag
The text between the start and end tags is the element content
HTML tags are not case sensitive, <b> means the same as <B>
</strong> tags.
Physical tags on the other hand provide specific instructions on how to display the text they enclose. Examples
of physical tags include:
<big>: Makes the text usually one size bigger than what's around it.
Physical tags were invented to add style to HTML pages because style sheets were not around, though the
original intention of HTML was to not have physical tags. Rather than use physical tags to style your HTML
pages, you should use style sheets.
<B> means the same as <b>. The World Wide Web Consortium (W3C), the group responsible for developing
web standards, recommends lowercase tags in their HTML 4 recommendation, and XHTML (the next generation
HTML) requires lowercase tags.
Tag Attributes
Tags can have attributes. Attributes can provide additional information about the HTML elements on your page.
The <tag> tells the browser to do something, while the attribute tells the browser how to do it. For instance, if
we add the bgcolor attribute, we can tell the browser that the background color of your page should be blue,
like this: <body bgcolor="blue">.
This tag defines an HTML table: <table>. With an added border attribute, you can tell the browser that the table
should have no borders: <table border="0">. Attributes always come in name/value pairs like this:
name="value". Attributes are always added to the start tag of an HTML element and the value is surrounded by
quotes.
Note: Some tags we will discuss are deprecated, meaning the World Wide Web Consortium (W3C) the
governing body that sets HTML, XML, CSS, and other technical standards decided those tags and attributes
are marked for deletion in future versions of HTML and XHTML. Browsers should continue to support
deprecated tags and attributes, but eventually these tagsare likely to become obsolete and so future
support cannot be guaranteed.
The most important tags in HTML are tags that define headings, paragraphs and line breaks.
Tag Description
Headings
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading while <h6> defines the
smallest.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
HTML automatically adds an extra blank line before and after a heading. A useful heading attribute is align.
Paragraphs
Paragraphs are defined with the <p> tag. Think of a paragraph as a block of text. You can use the align
attribute with a paragraph tag as well.
Important: You must indicate paragraphs with <p> elements. A browser ignores any indentations or blank
lines in the source text. Without <p> elements, the document becomes one large paragraph. HTML
automatically adds an extra blank line before and after a paragraph.
Line Breaks
The <br> tag is used when you want to start a new line, but don't want to start a new paragraph. The
<br> tag forces a line break wherever you place it. It is similar to single spacing in a document.
Horizontal Rule
The <hr> element is used for horizontal rules that act as dividers between sections, like this:
The horizontal rule does not have a closing tag. It takes attributes such as align and width. For instance:
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment can be placed
anywhere in the document and the browser will ignore everything inside the brackets. You can use
comments to write notes to yourself, or write a helpful message to someone looking at your source
code.
<p> This html comment would <!-- This is a This HTML comment would be displayed like
comment --> be displayed like this.
this.</p>
Notice you don't see the text between the tags <!-- and -->. If you look at the source code, you would
see the comment. To view the source code for this page, in your browser window, select View and then
select Source.
Note: You need an exclamation point after the opening bracket <!-- but not before the closingbracket --
>.
HTML automatically adds an extra blank line before and after some elements, like before and after a
paragraph, and before and after a heading. If you want to insert blank lines into your document, use the
<br> tag.
PRACTICAL 1
Write a HTML program to demonstrate use of Heading tag.
<html>
<head>
</head>
<body>
<dl>
<dt>CSE
<dt>ECE
<dt>IT
<dd>Information Technology
<dt>EEE
<dt>CE
<dd>Civil Engineering
</dl>
</body>
</html>
OUTPUT:
PRACTICAL 2
Write a HTML program to demonstrate Text Styles.
<html>
<head>
</head>
<body>
</body>
</html>
OUTPUT:
PRACTICAL 3
Write a HTML program to set background image.
<HEAD>
<HEAD>
</HEAD>
<centre>
<b>
DATA STRUCTURES<BR><BR>
PROGRAMMING IN C<BR><BR>
PROGRAMMING IN C++<BR><BR>
</b>
</center>
</BODY>
</HEAD>
OUTPUT:
PRACTICAL 4
Write a HTML program for the demonstration of Unordered List and
Ordered List.
<html>
<head>
<title>Ordered List</title>
</head>
<body>
<ul>
<li>Ms-Word
<li>Ms-Excel
<li>Ms-Powerpoint
<li>Ms-Access
</ul>
<li>Ms-Word
<li>Ms-Excel
<li>Ms-Powerpoint
<li>Ms-Access
</ol>
</body>
</html>
OUTPUT:
PRACTICAL 5
Write a HTML program for the demonstration of Definition List.
<html>
<head>
<title>Creating Definition List</title>
</head>
<body bgcolor=”pink”>
<h1 align=”center”>Definition List</h1>
<dl>
<dt>CSE<dd>Computer Science & Engineering
<dt>ECE<dd>Electronics & Communication Engineering
<dt>IT<dd>Information Technology
<dt>EEE<dd>Electrical & Electronics Engineering
<dt>CE<dd>Civil Engineering
</dl>
</body>
</html>
OUTPUT:
PRACTICAL 6
Write a HTML program using Hyperlinks to navigate from one page to another.
<html>
<head>
</head>
<body>
</body>
</html>
MYPAGE
<html>
<head>
<title>NPH SITE</title>
</head>
<body>
<centre>
DATA STRUCTURES<BR><BR>
PROGRAMMING IN C<BR><BR>
PROGRAMMING IN C++<BR><BR>
</body>
</html>
OUTPUT:
PRACTICAL 7
Write a HTML program using Hyperlinks to navigate within the same page.
<html>
<head>
</head>
<body>
<center>
CHAPTER 1 <BR><BR>
CHAPTER 2 <BR><BR>
CHAPTER 4 <BR><BR>
CHAPTER 5 <BR><BR>
CHAPTER 6 <BR><BR>
CHAPTER 7 <BR><BR>
CHAPTER 8 <BR><BR>
CHAPTER 9 <BR><BR>
CHAPTER 10 <BR><BR>
</center>
</body>
</html>
OUTPUT:
PRACTICAL 8
Write a HTML program for time-table using tables.
<html>
<head>
<title>Timetable</title>
</head>
<body>
<th>DAY</th>
<th>I</th>
<th>II</th>
<th rowspan="7"><b>T<br>E<br>A<br><br>B<br>R<br>E<br>A<br>K</b></th>
<th>III</th>
<th>IV</th>
<th>V</th>
<th>VI</th>
<th>VII</th>
</tr>
<tr align="center">
<th>MON</th>
<td>IS</td>
<td>WT</td>
<td>SEM</td>
<td>OOAD</td>
</tr>
<td>SCI</td>
<td>C#</td>
<td>COMP</td>
<tr align="center">
<th>TUE</th>
<td>AP</td>
<td>AP Lab</td>
<td>WT</td>
<td>IS</td>
<td>OOAD</td>
</tr>
<tr align="center">
<th>WED</th>
<td>WT</td>
<td>IS</td>
<td>C#</td>
<td>SCI</td>
<td colspan="3">MOOC'S</td>
</tr>
<tr align="center">
<th>THU</th>
<td>IS</td>
<td>LIB</td>
<td>OOAD</td>
<td>WT</td>
</tr>
<tr align="center">
</tr>
<th>FRI</th>
<td>AP</td>
<td>AP</td>
<td>C#</td>
<td>OOAD</td>
<tr align="center">
<th>SAT</th>
<td>OOAD</td>
<td>SCI</td>
<td>WT</td>
<td>SEM</td>
<td>AP</td>
<td>AP</td>
<td>C#</td>
</tr>
</table>
</body>
</html>
OUTPUT:
PRACTICAL 9
Write a HTML program using frame tag.
<html>
</frameset>
</html>
LIST
<html>
<head>
<title>Ordered List</title>
</head>
<body>
<li>Ms-Word
<li>Ms-Excel
<li>Ms-Powerpoint
<li>Ms-Access
</ol><br><br>
<li>Ms-Word
<li>Ms-Excel
<li>Ms-Powerpoint
<li>Ms-Access
</ol><br><br>
</body>
</html>
MYPAGE
<html>
<head>
<title>NPH SITE</title>
</head>
<body>
<centre>
DATA STRUCTURES<BR><BR>
PROGRAMMING IN C<BR><BR>
PROGRAMMING IN C++<BR><BR>
</center>
</body>
</html>
OUTPUT:
PRACTICAL 10
Write a HTML program to create a form.
<html>
<head>
<title>Registration</title>
</head>
<body bgcolor=lightblue>
<br><br><br>
<div>
<strong>
First Name   <input type=text value=" " name="txt1"><br><br> Last Name   <input
type=text value=" " name="txt2"><br><br> UserName   <input type=text value=""
name="txt3"><br><br> Password   <input type=password value="" name="pwd1"><br>
<option>--</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
mm<select name="sel2">
<option>--</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
yyyy<select name="sel3">
<option> </option>
<option>1987</option>
<option>1988</option>
<option>1989</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2015</option>
<option>2016</option>
<option>2017</option>
<br><br>
Martial Status  
<br><br>
<br><br>
<br><br>
<center>
</center>
</strong>
</body>
</html>
OUTPUT: