Unit-I Chapter 1
Unit-I Chapter 1
uses markup methods, to create hyper-text. HTML is actually a simplified of a more general
markup language called SGML, which stands for Standard Generalized Markup Language
system to allow scientists to share papers with other using electronic networking methods.
2. Tim Berners-Lee suggested that it be based on the already existing SGML. Here are a few
3. In 1991, Berners-Lee and the CERN team released the first draft HTML 1.0, which was
finalized in 1993.
4. In 1995, HTML 2.0 was developed by the Internet Engineering Task Forces HTML
Working Group with XML + HTML = XHTML. This group later was disbanded in favor of
HTML.
5. The World Wide Web Consortium (W3C), which had taken over HTML development,
version, HTML 3.2, was issued. This added features with HTML with CSS like tables, and
6. The W3C released the HTML 4.0 specification at the end of 1997, and followed with HTML
4.01 in 1999, which mostly corrected a few errors in the 4.0 specification.
7. XHTML 1.0 is the successor to HTML. The X stands for Extensible. This is a
******************************************************************************
HTML stands for Hyper-Text Markup Language. It allows us to create web pages. It
does not include any control structure and can produce only static content. A HTML page
consists of various tags that make a web page. The features, advantages and disadvantages
Features of HTML:
5.It is not case sensitive i.e. code can be written in small case or uppercase letters.
7.HTML documents can be edited using editors such as notepad or front page.
2.It can incorporate images and sounds with the help of HTML tags.
4. Browser Dependent.
******************************************************************************
HTML stands for Hyper-Text Markup Language. It allows us to create web pages. It does
not include any control structure and can produce only static content. A HTML page consists of
Webpage
HTML language. A webpage can embed a variety of different types of resources such as:
website
A collection of WebPages which are grouped together and usually connected together in
Web server
A web server is a computer hosting one or more websites. "Hosting" means that all the
Web Browser
A web browser is a software application that people use in order to view web pages on the
WWW
The World Wide Web (WWW) is an information space where documents and other web
resources are identified by URLs, interlinked by hypertext links, and can be accessed via the
Internet. The World Wide Web was invented by English scientist Tim Berners-Lee in 1989.
******************************************************************************
eclipse, etc…, after wrote a HTML document, it can be saved with the .html (or) .htm
extension, For running the html program click on the naming browser icon that can be run
We also add a Document type declaration on top of the basic document structure and
<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>
Every well written HTML document begins with a basic declaration that defines what type of
document it is. This declaration is made using the ! DOCTYPE tag and is to be written at
The beginning of the document. It tells the processing agent and HTML version. Sample is
shown below.
<HTML> tag:
The html tag acts as a container for the whole document. Every character in the document
should be in between the opening html (< >), and closing with (</ >) end tags. The html
tag can also be used to define the language of the contained document through the "lang"
attribute. The content of the html tag is divided in two parts using the
1. <HEAD> tag:
This section is the document's head. All the information contained in the document's head
is loaded first. It includes tags like title, script, style, Meta and so on.
2. <BODY> tag:
This is the document's body: The body is the container for the web page. All the things
written here will be shown when the document is rendered. Most of the tags in HTML can
Example:
<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>
Output:
******************************************************************************
HTML Tags: HTML uses markup tags to describe web pages. HTML markup tags are usually
1. Heading tag,
2. Paragraph tag,
2) HTML tags normally come in pairs like <tag-name> and </tag-name>, such tags are called
paired tags.
3) The first tag in a pair is the start tag, the second tag is the end tag
4) Start and end tags are also called opening tags and closing tags.
5) Some of the tags have only opening tag. These are called (unpaired) empty tags like
<BR>, <HR>.
6) Each tag may have attributes in them as in <font color=’red’>, here color is attribute and
7) No tag in HTML is mandatory. But, a well written HTML document has <HTML>, <HEAD>
8) Tags are not case sensitive i.e. they may be written in lower or upper case letters.
9) Some tags can also be nested within other tags; for example:
1. Heading Tags
Heading: There are six headings are available in html starts from <h1> to <h6>, tags are
used to define HTML headings. <h1> defines the most important heading and <h6> defines
the least important heading. The syntax of <h1> to <h6> tags is:
The align attribute is optional. It defines the horizontal alignment of its content.
<h1> . . . </h1>
<h2> . . . </h2>
<h3> . . . </h3>
<h4> . . . </h4>
<h5>. . . </h5>
<h6>. . . </h6>
The HTML <hr> tag draws a horizontal line and that may be used as separator. This tag
has a set of attributes such as align, noshade, size and width and they are optional. The
3. Paragraph Tag
Using paragraph, text will be displayed in a separate line. <P> is a tag which is used to create
a paragraph in a HTML page.
The align attribute is optional. It defines the horizontal alignment of its content. Possible
values are:
Left: Text is aligned to the left margin.
Right: Text is aligned to the right margin.
Center: Text is centered.
Justify: Text is justified to both margins.
<! -- This code demonstrates the -- --purpose of headers, paragraph, -- -- break and
<html>
<head>
</head>
<body>
<hr width=50%>
</body>
</html>
Output:
******************************************************************************
1. Header -
There are 6 levels of headings available, from h1 for the largest and most important heading,
2. Bold -
The text in between the tags will be bold, it is used to make the text as bold, the same as in
a word processor.
3. Italic -
Also working the same way as a word processor, italics display the text at a slight angle.
4. Emphasis -
Used to emphasize text, which usually appears in italics, but can vary according to your
browser.
5. Underline –
Again the same as underline in a word processor. Note that html links are already underlined
7. Strike-out -
Puts a line right through the centre of the text, crossing it out. Often used to show that text is
8. Preformatted Text -
Any text between the pre tags, including spaces, carriage returns and punctuation, will appear
in the browser as it would in a text editor (normally browsers ignore multiple spaces)
9. Typewriter Text –
10. Small -
Instead of having to set a font size, you can use the small tag to render text slightly smaller
The superscript tag is used to generate a uperset(power). This tag is used for example in
displaying format
The superscript tag is used to generate a subset. This tag is used for example in displaying
format
13. <font>
Specifies the font face, font size, and font color of text.
Prepared By: M. VENKAT (MCA, M-Tech) Lecturer in computer Science
Page No:-13
14. Centre -
A useful tag, as it says, it makes everything in between the tags centered (in the middle of the
page).
<html>
<head>
<title> Text Formatting Tags</title>
</head>
<body>
<h1>Header Size 1</h1>
<h3>Header Size 3</h3>
<center>
<b>Bold Text</b> <br/>
<i>Italic Text</i> <br/>
<u>underlined text.</u><br/>
</center>
<p><font size="5">Welcome</font><br/>
H<sub>2</sub>O
X <sup>2</sup>
<em>Text in Emphasis</em><br/>
<strong>Text in Strong</strong><br/>
<pre>
This is preformatted text (using the PRE) tag as it appears in the editor
view.
</pre>
<hr>
<small>The fine print </small>
</body>
</html>
Output
******************************************************************************
image that you can click on to jump to another document. When we move the cursor over a
link in a Web page, the arrow will turn into a little hand.
The most important attribute of the <a> element is the href attribute, which indicates the
links destination.
Ex:
Which will display like this: Visit www.google.com Clicking on this hyperlink will send the
1. Text hyperlinks.
An text hyper links are redirect to the web page when you click on the text. Example
2. Image hyperlinks
An image hyperlinks are redirect to the web page when you click on the image. Example
3. Mail hyperlinks
An mail hyper links are redirect to the mail when you click on the mail. Example
Note: The "Link text" doesn't have to be text. It can be an image or any other HTML element.
The target attribute specifies where to open the linked document. The following example will
open the linked document in a new browser window (or) a new tab:
Ex:
Step:1 Open the Notepad and type the following code and save it as first.html .
<html>
<head>
<title>First Page</title>
</head>
<body>
<h3>Linking to another page</h3>
<p>Hai, this is Venkat<br>
To know about me please <a href="second.html">Click Here</a>
</body>
</html>
Step:2 Open the Notepad and type the following code and save it as second.html .
<html>
<head>
<title>Second Page</title>
</head>
<body>
<pre>
Name: M. Venkat
</pre>
</body>
</html>
Output:
******************************************************************************
1. Ordered Lists
2. Unordered Lists
3. Definition Lists
1. Ordered lists
Ordered lists, or numbered lists, are used to display a list of items, which need to be placed in
a specific order. An example would be displayed list computer subjects, which must be
1. Language C
3. Data structure
5. Software engineering
6. Web technologies
An ordered list can be numerical or alphabetical. The <ol> tag defines an ordered list.
<html>
<head>
<title>Ordered List in HTML</title>
</head>
<body>
<h3>An Ordered List</h3>
<ol>
<li> Language C</li>
</ol>
</body>
</html>
Output:
2. Unordered lists
Unordered lists, or bulleted lists, are used when a set of items can be placed in any order.
bread
coffee beans
milk
butter
Example:
<html>
<head>
<title>Unordered List</title>
</head>
<body>
<h3>A Bulleted List</h3>
<ul type="disk">
<li>bread</li>
<li>coffee beans</li>
<li>milk</li>
<li>butter</li>
</ul>
Output:
3.Definition List
A definition list is not a list of single items. It is a list of items (terms), together with a
description of each item (term). A definition list starts with a <dl> tag (definition list). Each term
starts with a <dt> tag (definition term). Each description starts with a <dd> tag (definition
description(data)).
Ex:
<html>
<body>
<h4>A Definition List:</h4>
<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>
</body>
</html>
Output:
A nested list is a list within another list. Usually the second list is indented another level and the
Ex:
<html>
<body>
<h4>A Nested List:</h4>
<ul>
<li>Coffee</li>
<li>Tea
<ul type=disc>
<li>Black tea</li>
<li>Green tea
<ul type=square>
<li>China</li>
<li>Africa</li>
</ul>
</li>
</ul>
</li>
<li>Milk</li>
</ul>
</body>
</html>
Output:
******************************************************************************
defined using the <table> tag. A table is divided into rows with the <tr> tag, and each row is
divided into data cells using the <td> tag. The letters td stand for table data, which is the
content of a data cell. A data cell can contain text, images, lists, paragraphs, forms,
Ex:
<tr>
<th>column1 heding</th>
<th>column2 heding</th>
</tr>
<tr>
<td>column1 data</td>
<td>column2 data</td>
</tr>
And so on ..
</table>
We can also apply require changes for the specify rows and columns with this rowspan and
colspan attributes.
</body>
</html>
Output:
Table Borders:
The border attribute controls the appearance of the tables borders or lines. The default border
is 0, so if we do not specify a border attribute, the table is displayed without any borders.
Sometimes this is useful, but most of the time, we want the borders to be visible.
Ex:3 The following code demonstrates the use of different table borders.
<html>
<body>
<h4>With a normal border:</h4>
<table border="1">
<tr>
<td>First</td>
<td>Row</td>
</tr>
<tr>
<td>Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
Output:
2) tfoot is used to enclose a group of rows in a table as a footer, such as last row for
summary.
The {thead, tbody, tfoot} do not have any default rendering. (use CSS for that) When using
thead or tfoot, you can use th instead of td, which will make it bold. Example:
<html>
<head>
<title>Table wit thead, tfoot and tbody tags</title>
</head>
<body>
<table border="1">
<thead>
<tr>
<th>cats</th>
<th>dogs</th>
</tr>
</thead>
<tbody>
<tr>
<td>7</td>
<td>6</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="2">Cats win!</th>
</tr>
</tfoot>
</table>
</body>
</html>
HTML colors are defined using a hexadecimal notation (HEX) for the combination of Red,
Green, and Blue color values (RGB). The lowest value that can be given to one of the light
sources is 0 (in HEX: 00). The highest value is 255 (in HEX: FF). HEX values are specified
as 3 pairs of two-digit numbers, starting with a # sign. The combination of Red, Green, and
Blue values from 0 to 255, gives more than 16 million different colors (256 x 256 x 256).
The 17 standard colors are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive,
141 color names are defined in the HTML and CSS color specification (17 standard colors
bgcolor attribute:
Ex:
<html>
<body bgcolor="red">
<h1>Hello world!</h1>
</body>
</html>
When we execute the above code, the background color of the web page changes to red.
color attribute:
The color attribute specifies the color of the text inside a <font> element.
Ex:
******************************************************************************
In HTML, images are defined with the <img> tag. The img tag is empty, which means that it
To display an image on a page, we need to use the src attribute. src stands for
source. The value of the src attribute is the URL of the image we want to display on our
The URL points to the location or address where the image is stored.
1. <imgsrc=URL|nameheight=nwidth=n[alt=”string ‟]
[align=”top”|”center”|”bottom”] usemap=”URL”]>
2. Displays an inline image i.e., an image appears in the body of the text.
Uses an ordinary hypertext link and URL should point the image file.
Creates a clickable area on an image map. The attribute alt= string indicates for the reader
Ex:
<html>
<body>
<p> An image: </p>
<p>
<img src="E:/B.Sc/ohm.jpg" width="100" height="100" />
</p>
</body>
</html>
Output:
Background Images:
The following example demonstrates how to add a background image to an HTML page.
Ex:
<html>
<font color=red>
<p>If the image is smaller than the page, the image will repeat itself.</p>
</font>
</body>
</html>
Output: