Professional Documents
Culture Documents
Contents
HTML stands for Hyper Text Markup Language, the standard used by World Wide
Web (www) documents. The basic element of an HTML page is ASCII text. A
HTML file can be created using any simple text editor, like notepad or WordPad
and must have an htm or html file extension. The HTML elements are defined
using HTML tags represented by the angular brackets “<“ and “>” Any web
browser like Internet Explorer or Netscape Communicator is required to interpret
an HTML file.
A web page can be easily created using any simple text editor. All HTML files are
simple ASCII text files so any program having capabilities to save files in ASCII
format can be used to create HTML files. A web browser is used to view a HTML
file. In Internet explorer, the File | Open command is used to open a file on local
host or on Internet.
The primary major difference between the two is the relative strictness of XHTML
compared to HTML. While someone coding in HTML could get away with some
lapses in structure and coding, that is no longer possible with XHTML. The need
to come up with XHTML emerged from the fact that HTML has become to
convoluted with browser specific tags that pages coded in html doesn‟t always
look the same in all browsers.
All XHTML documents must have only one root element and all elements must
be written in lowercase, closed, and properly nested. And although you can
actually do the same with HTML, it is actually not required and you can violate
any or all of those rules and your HTML document can still be opened without
any errors.
Part of HTML‟s success was the fact that it was a very forgiving language to code
in. Whatever you put into the file, the browser tries to make sense of it and puts
up its best interpretation of the html file. But as browser technologies improve
and webpage designs become more complex, the simplistic approach of HTML
begins lose ground to XHTML‟s structured approach that doesn‟t leave any
guessing to the browser. Though it is hard to notice for those who only browse
the sites, there is already a gradual shift among webpage builders from HTML to
XHTML. Indicating that HTML would soon be yielding its position to XHTML in the
near future.
Document Tags
Document tags define different parts of every HTML page you create. An HTML
document has two distinct parts-a head and a body. To create the head portion
of your HTML document, the following text in entered in text editor:
<head>
<title> My Web Page </title>
</head>
This information is displayed in the title bar of the browser window. The head
portion is the information between the tags <head> and </head> The body is
where you do most of the work like entering text, graphics, headlines etc. Body
section starts after </head> tag, and between two tags <body> and </body>.
In order that all web browsers recognize that your file as an html document,
enter <html> before the first <head> tag and </html> after the last </body>
tag. Now create your first html document by entering the following in a blank
text file:
<html>
<head>
<title> My first web page </title>
</head>
<body>
I am learning
</body>
</html>
Select File|Save As command from notepad and save this file as prog0.html.
Now open your web browser and select the File|Open menu option, browse for
the file prog0.html, select OK to load it to your web browser. You will have the
output similar to following figure. Tags are not case-sensitive and may be
written in uppercase or lowercase as per your wish.
The tags which have the form <> and </> are called container tags. The
<html>, <head>, <title> and <body> tags are all container tags .Some tags do
not require „</>‟, such tags are called empty tags. For example horizontal rule
tag written as <hr>, draws a line across the width of the document. Enter the
following lines in prog1.html:
<html>
<head>
<title> My Web Page </title>
</head>
<body> Empty tags does not require closing
bracket
<hr><hr>
you are below two line.
</body>
</html>
Comment Tag
Comment tag helps to make comments in your document which can help you
when you edit the source code at a later date. Anything you type between <!...
and …> is ignored by the browser. Even the multiple lines are ignored. Note that
you need an exclamation point after the opening bracket, but not before the
closing bracket.
Comment tags are used for own benefit to mark a point in a particular document
or to explain a particular confusing part of your document
For entering paragraph into an HTML document, you have a container tag-the
<p> (paragraph) tag. It tells the browser that text in your document constitute
a paragraph. As such browser ignores more than one space and any number of
returns in a paragraph container. Only when you start another paragraph tag
<p>, the browser inserts a line between the texts. Please note that returns and
spaces never affect the way in which text is displayed on the screen. Enter the
following two examples one by one in template2.txt:
<p>We are learning paragraph tag here which is responsible for giving
paragraphs to your document. Even though we have entered a new paragraph,
the browser will ignore this and consider it as single paragraph only.</p>
<p>This is next paragraph. A new paragraph is created only when you end one
tag and begin with new paragraph tag</p>
You saw that both the examples appeared in the Web browser, in exactly the
same way.
Enter the following lines a text editor and display it via your web browser.
<p>
Mahan Institute of Technologies
GN-10, Shivaji Enclave
Near Shivaji College/Raja Garden
New Delhi-110027
</p>
Though you have typed an address in a text file making all necessary formatting,
your address becomes illegible. How?
This happened because your Web browser ignored extra spaces and returns!
Now if you put paragraph container here, you will end up with an extra space
between each line, which again is not a correct way to write an address.
So what you require is a new tag and that tag is <BR> tag, an empty tag. This
tag puts a line return in your web document. Now using this tag, try the
following lines:
<p>
Mahan Institute of Technologies<BR>
GN-10, Shivaji Enclave <BR>
Near Shivaji College/Raja Garden <BR>
New Delhi-110027 <BR>
</p>
Exercise 1:
Create a web document similar to the following figure:
Exercise 2:
Create a web document similar to the following figure:
In this section you will study how to organize text in an HTML document, how to
emphasize on certain text implicitly and explicitly as per your requirement.
2.1 Headings
You differentiate a portion of text from rest of the text is by use of the header
tags <h1>, a container tags having range from level 1 to 6. <h1> defines the
largest heading; <h6> defines the smallest heading. Header tag creates a new
line after its closing </h> tag. These tags allow you to create different level of
emphasized headings to organize your document. Enter the following program in
a text editor to see the result of these tags.
<html>
<head>
<title> my web page </title>
</head>
<body>
<h1> level 1 heading </h1>
<h2> level 2 heading </h2>
<h3> level 3 heading </h3>
<h4> level 4 heading </h4>
<h5> level 5 heading </h5>
<h6> level 6 heading </h6>
</body>
</html>
Below is an example through which you can differentiate between physical and
logical tags, if your browser shows any.
<html>
<head>
<title> Presentations and Seminars </title>
</head>
<body>
<p> At Mahan, there is a willingness to get the students involved intensively in
all activities <b> Seminars </b> on current topics are held from time to time
on the <strong> latest developments
</strong> in the industry. <br>
</p>
<p> Students are also required to make <i> presentations </i>
on <em> Projects and Topics </em> as part of their
curriculum <br>
</p>
</body>
</html>
Some characters have a special meaning in HTML, like the less than sign (<)
that defines the start of an HTML tag and also there are some special symbols
like © that may be required in your document. To display these characters, you
must insert character entities in your HTML source.
A character entity has three parts: an ampersand (&), an entity name or # and
an entity number, and finally a semicolon (;). To display a less than sign in an
HTML document we must write: < or <. Some most common entities are
tabulated below:
You may use name or a number as per your choice. Though a name is easier to
remember compared to a number, all browser do not support name. Note that
the entities are case sensitive.
A list of items in which items are marked with numbers is called an ordered list.
An ordered list is created with the <ol> and </ol> tags. Each list item starts
with the <li> tag and list heading is given by <lh> tag. The output of following
text in html template.html will generate the output shown in figure.
<html>
<head>
<title> My courses </title>
</head>
<body>
<ol>
<lh><B> INFORMATION TECHNOLOGY</B>
<br>
<li>DOEACC 'O' 'A' 'B' and 'C' Level
<li>MCITS <li>System Administrator
<li>KSOU
<li>Java and .Net technologies</ol>
</body>
</html>
Inside a list item you can put paragraphs, line breaks, images, links, other lists,
etc. A list inside a list is called nested list. The “type” attribute of <ol> tag is
used to list items in numbers, Roman numerals or letters as per requirement.
The various attribute value along with description is tabulated below:
Attribute Description
Type=A List markers would be set to uppercase letters
Type=a List markers would be set to lowercase letters
Type=I List markers would be set to uppercase Roman Numerals
Type=i List markers would be set to lower Roman Numerals
Type=1 List markers would be set to numbers
<html>
<head>
<title> Nested Lists </Title>
</head>
<body>
<ol>
<lh><em>Mahan Institute of Technologies</em> <br>
<li>Information Technology
<ol type=1>
<li>ADIT<li>HDIT
<li>MCA
<li>M.Tech</ol>
<li> Retail Management
<ol type=1>
<li>Executive
<li>Supervisor
<li>Manager
<li>BBA</ol>
<li>Professional English
<ol type=1>
<li>Spoken
<li>Writing
<li>Listening
</ol>
</ol>
</body>
</html>
The output of the following nested lists using attribute is shown in the figure
below:
Unordered lists: The list items are marked with bullets in an unordered list.
<ul> and </ul> tags are used to create unordered lists. Each list item starts
with the <li> tag. The type attribute of <li> tag when has “value=circle” creates
a circle and when has “value=disc” creates a filled circle (bullet). Inside a list
item you can put paragraphs, line breaks, images, links, other lists, etc.
Definition lists: These lists are also known as glossary lists consists of a list of
terms and explanation of the terms. A definition list starts with the <dl> tag,
each definition-list term starts with the <dt> tag and each definition-list
definition starts with the <dd> tag. Inside a definition-list definition (the <dd>
tag) you can put paragraphs, line breaks, images, links, other lists, etc.
Exercise 1:
a. Use of paragraphs.
b. Use of 1 or more levels of section headers.
c. Use of highlighting (bold, italics, etc.)
d. Use of lists.
Exercise 2:
You can display images in a HTML document. There are many image formats
available today; few being most popular are GIF, JPEG, PCX, PNG, WMF etc.
While inserting images in an HTML document, one should restrict to JPEG or GIF
formats only because these two formats are widely supported by a range of web
browsers.
In HTML, images are defined with the <img> tag with its src attribute (src
stands for “source”). The value of the src attribute is the URL of the image you
want to display on your page. The <img> tag is empty, which means that it
contains attributes only and it has no closing tag.
The URL points to the location where the image is stored. An image named
"image1.jpg" located in the directory "ignou" in “D:” drive has the URL:
D://ignou/image1.jpg. The browser puts the image where the image tag occurs
in the document. For example, the following listing will put the image before the
text as shown in figure.
<html>
<head>
<title>Images in HTML </title>
</head>
<body> <p>
<img src="d://mahan/image1.jpg"> Images preceeds this text </p>
</body>
</html>
Value Meaning
<html>
<head>
<title>Images in HTML </Title>
</head>
<body><p>
<img src="d://mahan/image1.jpg" align=middle> Images precedes this
text but
in middle
</p>
<p>
<img src="d:// mahan /image1.jpg" align=top> Images precedes this text but
at the top
</p>
<p>
<img src="d://mahan/image1.jpg" align=bottom> Images precedes this text
but at bottom </p>
</body>
</html>
The "alt" attribute is to improve the display and usefulness of your document
that tells the user what they are missing in absence of a graphics based browser.
Links are used to connect various web resources to your current document. It is
done by anchor tags <a> and </a> and href attribute of this tag. An anchor can
point to any resource on the Web: an HTML page, an image, a sound file, a
movie, etc. These links are called hypertext links and would appear underlined
or in different colour to distinguish it from normal text.
There are two categories of links: Relative links and Absolute links.
Relative links: Theses refer documents in the current directory or within the
same page on which the link is used. For references to the current document,
you need to use two instances of the anchor tag
<html>
<head>
</head>
<body>
</html>
When <base> tag is used in an HTML document, references are then always
relative to the url given in the tag. For example:
http://www.mahan.com/cgi-bin/submit.pl
Absolute links: These provide full address or the URL of the document,
described in the link text.
With HTML you can create tables also with the <table> tag. These are defined
row by row with the <tr> tag and each row is divided into data cells with the
help of <th> (table header) and <td> (table data) tags. The “border” attribute
of the table creates a table with border and it takes the value in pixels.
“border=0” creates a borderless table.
<html>
<head>
<title>TABLES </Title>
</head>
<body>
<table border=5>
<caption> BCA Project status report </caption>
<tr>
<th> Project</th> <th> Roll No </th> <th> Status </th>
<tr>
<td> Hospital Management System </td>
<td>BCA001</td><td> Submitted </td>
</tr>
<tr>
<td> Hotel Management System </td>
<td>BCA002 </td><td>Not submitted </td>
</tr>
</table> <br>
<table border=5>
<caption> MCA Project status report </caption>
<tr>
<th> Project</th> <th> Roll No </th> <th> Status </th>
<tr>
<td> A prototype of GIS </td>
<td>MCA001</td><td> Passed with A grade</td>
</tr>
<tr>
<td> www.eyatra.com </td>
<td>MCA002 </td><td>Not submitted </td>
</tr>
</table>
</body>
</html>
A data cell can contain text, images, lists, paragraphs, forms, horizontal rules,
tables, etc.
Tag Description
<col> Defines the attribute values for one or more columns in a table
HTML Forms are used to select different kinds of user input, it allow user to
interact by sending the requested information in the form of text, drop-down
menus, radio buttons, checkboxes, etc.
A form is defined within <form> and </form> tags with the help of <input>,
<select> and <textarea> tags.
<form>
<input>
<input>
</form>
<input> tag: The most used form tag is the <input> tag. This is an open tag
and is used to add graphical user interface such as text fields, password fields,
check boxes, radiobuttons, reset button and submit buttons. The different
attributes for the <input > tags are:
HTML presents us with various form object/elements that are placed INSIDE the
form tags.
<INPUT TYPE="TEXT">
<INPUT TYPE="PASSWORD">
<INPUT TYPE="RADIO">
<INPUT TYPE="CHECKBOX">
<INPUT TYPE="BUTTON">
<INPUT TYPE="RESET">
<INPUT TYPE="SUBMIT">
<INPUT TYPE="HIDDEN">
<INPUT TYPE="IMAGE">
<INPUT TYPE="FILE">
<SELECT>...</SELECT>
<TEXTAREA>...</TEXTAREA>
<BUTTON>...<BUTTON>
<OPTION>...</OPTION>
The first ten listed above are all variants of the <INPUT> element. However,
since their TYPE is different, the other attributes taken by them differ. We shall
explore these along with their attributes, one by one.
is displayed as:
Your first name
Type your first name in the box:
This object is very similar to the TEXT mentioned above and takes the same
attributes. Its inclusion also causes the display of a text field. However, anything
typed by the user inside this text field is replaced by *s or other characters that
mask what you type. Try this out yourself.
Attributes:
NAME: Sets a name for the password field by which it is referred using
scripting languages.
MAXLENGTH: Sets the maximum number of characters a user can input.
SIZE: Takes a number as value and specifies the size.
VALUE: Specifies a default value.
<INPUT TYPE="CHECKBOX">
<INPUT TYPE="RADIO">
Makes a radio button. The attributes taken are similar to those of a checkbox
(above).
CHECKED: Puts the radio button to "ON" state. Takes no value.
NAME: Assigns a name to the radio button.
VALUE: Specifies a value that can be passed to the server.
These two elements are not the same though they share the same attributes.
Radio buttons are employed when a single reply is desired from a list of choices.
In such cases, radio buttons with the same name but different values are
grouped together. Since the buttons have the same name, the user is able to
select only one. The value of the selected button along with its name is sent to
the server. Checkboxes on the other hand, can be used in two ways. One to get
a 'yes'/'no' kind of response and the other to get a multiple selection.
Try to select two radio buttons... you can't... that is because they have the same
name. Thus, the code above presents a list of choices and expects only one
selection.
Notice that the CHECKED attribute selects the first radio button when the page is
first loaded. Depending on the selection, the associated value is sent to the
server along with the radio button name. So, if the visitor selects Can't Say, the
associated value notsure is sent along with button name, moz.
Notice that in this case too, all checkboxes have the same name. However, you
can select multiple boxes (try it out...). This is helpful when we desire zero or
more values. Values of all checkboxes that are selected are sent to the server
along with checkbox name for further processing by a CGI script.
Another use of checkboxes is to get a 'yes'/'no' kind of response as in:
Although, radio buttons can be employed for the same purpose, I prefer to use
checkboxes since they display a better icon.
So, radio buttons or checkboxes are used depending on the type of question you
have. A generalization would be to employ radio buttons for questions where
only one reply is desired and checkboxes for questions where multiple replies are
possible.
This creates a button which is quite useful for triggering JavaScript events.
NAME: Specifies a name for the button.
VALUE: Determines what is written on the button.
The button above does nothing when clicked. However, you can attach
JavaScript event handlers to this button to set up some kind of action.
Send Email
Clicking on a submit button sends the name-value pairs of all form elements to
the server. (Note: This submit button does not work. However, you can test one
on the right to join my mailing list!)
<INPUT TYPE="FILE">
Allows your users to send files to your server. It is accompanied with a Browse
button that helps the user locate the file on his computer.
Attributes taken are:
ACCEPT: Its value is a MIME type/s that your server program is ready to
accept. A comma-separated list of mime types can be supplied.
NAME: Specifies a name for the element.
VALUE: Specifies the default text inside the text field.
<INPUT TYPE="IMAGE">
This is a great tag allowing designers to make their own buttons. With its use
you can replace the dull default button with a colorful image.
There are four attributes associated with this tag
SRC: a required attribute that points to the URL of the image file.
NAME: Gives a name to the element.
ALIGN: aligns the surrounding text with respect to the image.
BORDER: sets the border around the image. If zero is assigned as its value,
no border is displayed.
<INPUT TYPE="HIDDEN">
This creates a form input field which is not displayed in the browser. It is ideal
for passing values set by the programmer or by certain actions of the user.
It has only two attributes.
NAME: Defines a name for the element.
VALUE: Sets a value for the element.
The individual items of the list are placed with the help of another tag,
<OPTION> (described below).
The attributes taken are:
NAME: defines a name for this element.
SIZE: if the size is '1', the list is displayed as a dropdown menu else as a
scrolling list.
MULTIPLE: allows for multiple selection.
Here is how you create a four-item drop down selection list.
Window s
Which system do you use?
<OPTION> </OPTION>
The <OPTION> tag defines an item of the selection list described above. Its end
tag is not required. It takes two attributes:
VALUE: Gives a value to the item that is sent to the server along with the
selection list name.
SELECTED: Selects an item when the form is displayed.
Unix
Which system do you use?
To define a value for the TEXTAREA, include the text between the start and end
tags.
<BUTTON>...</BUTTON>
This element is specific to Internet Explorer and ignored by Netscape.
It creates a button that is quite similar to ones made by <INPUT
TYPE="BUTTON">. It takes the following attributes:
NAME: Sets a name for the button.
TYPE: Can take either SUBMIT, RESET or BUTTON as value.
VALUE: Defines the value that is sent to the server along with the button
name.
5.1 Frames
With frames, you can display more than one HTML document in the same
browser window. Each HTML document is called a frame, and each frame is
independent of the others. Frames provide an effective way to organize the web
content by dividing the page into different parts.
In the example below “frames.htm” we have a frameset with two columns. The
first column is set to 300 pixel of the width of the browser window. The second
column is set to rest of the width of the browser window. The HTML document
"navigate.htm" is put into the first column, and the HTML document "main.htm"
is put into the second column.
Frames.htm
<html>
<head>
<title> Frames in HTML</Title>
</head>
<frameset cols="300,*" border=10>
<frame name= "Navigation" src="navigate.htm" NORESIZE
SCROLLING="AUTO">
<frame name= "Main" src="main.htm" NORESIZE
SCROLLING="AUTO">
</frameset>
<noframes> Your browser cannot process frames so acquire one and revisit
this site.
</noframes>
</html>
Navigate.htm
<html>
<head>
<title>Frames </Title>
</head>
<body>
<center>
<h3>
<a href="index.htm"> About us </a><br><br>
<a href="courses.htm"> Courses </a><br><br>
<a href="faculties.htm"> Faculties </a><br><br>
<a href="contact.htm"> Contact us </a><br><br>
</h3>
</center>
</body>
</html>
Main.htm
<html>
<head>
<title>Frames </Title>
</head>
<body>
<center>
<h1 align="center"> Welcome to MAHAN Institute Of Technologies
</h1>
<p> Welcome to MAHAN Institute home page
</p>
</center>
</body>
</html>
Note: The frameset column size value can be set in pixels (cols="200,500") or
percentage where one of the columns can be set to use the remaining space
(cols="25%,*").
A CSS (cascading style sheet) file allows you to separate your web sites (X)HTML
content from it's style. As always you use your (X)HTML file to arrange the
content, but all of the presentation (fonts, colors, background, borders, text
formatting, link effects & so on...) are accomplished within a CSS.
At this point you have some choices of how to use the CSS, either internally or
externally.
First we will explore the internal method. This way you are simply placing the
CSS code within the <head></head> tags of each (X)HTML file you want to
style with the CSS. The format for this is shown in the example below.
<head>
<title><title>
<style type="text/css">
CSS Content Goes Here
</style>
</head>
<body>
With this method each (X)HTML file contains the CSS code needed to style the
page. Meaning that any changes you want to make to one page, will have to be
made to all. This method can be good if you need to style only one page, or if
you want different pages to have varying styles.
External Stylesheet
Next we will explore the external method. An external CSS file can be created
with any text or HTML editor such as "Notepad" or "Dreamweaver". A CSS file
contains no (X)HTML, only CSS. You simply save it with the .css file extension.
You can link to the file externally by placing one of the following links in the head
section of every (X)HTML file you want to style with the CSS file.
Either of these methods are achieved by placing one or the other in the head
section as shown in example below.
<head>
<title><title>
<link rel="stylesheet" type="text/css"href="style.css" />
</head>
<body>
or
<head>
<title><title>
<style type="text/css"> @import url(Path To stylesheet.css) </style>
</head>
<body>
By using an external style sheet, all of your (X)HTML files link to one CSS file in
order to style the pages. This means, that if you need to alter the design of all
your pages, you only need to edit one .css file to make global changes to your
entire website.
Easier Maintenance
Reduced File Size
Reduced Bandwidth
Improved Flexibility
The term „Web 2.0‟ was coined to define an emerging pattern of new uses of the
Web and approaches to the Web development, rather than a formal upgrade of
Web technologies as the 2.0 version number may appear to signify. The key
Web 2.0 concepts include:
A network effect: This describes applications which are more effective as the
numbers of users increase. This effect is well-known in computer networks, with
the Internet providing an example of how network traffic can be more resilient
as the numbers of devices on the Internet grows.
The long tail: As the numbers of users of the Web grows, this can provide
business opportunities for niche markets which previously it may not have been
cost-effective to reach.
Network as a platform: The Web can now be used to provide access to Web
applications, and not just informational resources. This allows users to make use
of applications without having to go through the cumbersome exercise of
installing software on their local PC.
Blogs: A Web site which is commonly used to provide diaries, with entries
provided in chronological order. Blogs can be used for a variety of purposes,
ranging from reflective learning by students and researchers through to
dissemination channels for organisations.
Syndicated content: RSS and Atom formats have been developed to enable
content to be automatically embedded elsewhere. RSS was initially developed to
support reuse of blog content produced. RSS‟s success led to the format being
used in other areas (initially for the syndication of news feeds and then for other
alerting purposes and general syndication of content). The Atom format was
developed as an alternative to RSS.
Social networks: Communal spaces which can be used for group discussions
and sharing of resources.