CHAPTER 10
HTML-I
BASIC HTML ELEMENTS
HTML (Hyper Text Markup Language) is a document-layout and
hyperlink-specification language i.e., a language used to design the
layout of a document and to specify the hyperlink.
HTML tells the browser how to display the contents of a hypertext
document i.e., a document including text, images and other support
media.
HTML : What it is HTML: What it is not
Web Page Layout Language Word Processing Tool
Hyperlink Specification Language Programming Language
WRITING HTML DOCUMENTS
HTML is made up of Tag and Attribute.
TAG
A Tag is a coded HTML command that indicates how part of web page should
be displayed. All HTML tags are contained with angle brackets (< >) e.g.,
<HEAD> is a tag. Similarly <H1> is a tag.
ATTRIBUTE
An Attribute is a special word used inside tag to specify additional information
to tag such as color, alignment etc.
You can type HTML in capital letters as well as in small letters.
HTML DOCUMENT STRUCTURE
This tag identifies the document as an HTML
document. An HTML document begins with
<HTML> and ends with </HTML>
<HTML>
The <HEAD> tag contains
<HEAD> information about the
document, including its
<TITLE> Title of page is written here </TITLE> title, and document
description.
</HEAD>
The <HEAD> tag is entered
between <HTML> tags.
<BODY>
This tag contains the
The HTML tags that define your page go document title. The title
here specified inside <TITLE> tag
appears on the browses’
</BODY>
title bar.
</HTML>
The <BODY> tag encloses all the tags,
attributes and information to be
displayed in the web page.
The <BODY> tag is entered below the
closing </HEAD> tag and above the
closing <HTML> tag.
HEADER
BODY
WHERE TO WRITE HTML CODE
1. Open Text Editor, (Notepad in case of Windows Operating System).
2. Type the HTML code in it.
3. Save the file with extension .html/.htm
4. To view the created HTML file in browser , double click on the file.
CONTAINER ELEMENTS
HTML container elements require a starting as well as an ending tag. Some
examples of container elements are:
<HTML> …………………..</HTML>
<HEAD> …………………..</HEAD>
<TITLE> …………………..</TITLE>
<B> …………………..</B>
EMPTY ELEMENTS
HTML Empty elements require just a starting tag and not an ending tag. Some
examples of Empty Container are:
<br>
<hr>
<img>
HTML TAG STRUCTURE
1. Every HTML tag consists of a tag name, sometimes followed by an
optional list of attributes, all placed between opening and closing angle
brackets (< and >).
2. A tag attribute’s value, if any, is given after the equal sign (=) in quotes
generally after the attribute name. For example,
<A href = http://www.netscape.com/yellowpages>
Some examples of HTML tags with attributes are:
<body bgcolor = “red”>
TAG ATTRIBUTE
BASIC HTML TAGS
1. The HTML Tag
The <HTML> and </HTML> tags are used to mark the beginning and
end of an HTML document.
This tag does not have any effect on appearance of document.
This tag is used to make browsers and other programs know that this
is an HTML document.
Attributes of HTML tag
(i) The DIR attribute
This attribute can have values either ltr(left-to-right) or rtl(right-to-left).
e.g. <HTML dir = ltr>
(ii) The LANG attribute
This attribute of <HTML> tag specifies the language you’ve generally
used within the document.
To specify base language of web page, the LANG attribute is used. e.g.
“en” is used to specify English Language and “fr” is used to specify
French language.
e.g. <HTML lang = en>
HTML Tag
Type Container Element
Function Delimits a complete HTML document
Attributes DIR, LANG
Contains Head-tag, body-tag
2. The HEAD Tag
The HEAD tag is used to define the document header.
<HEAD> tag contains information about the document, including its title
and document description.
HEAD Tag
Type Container Element
Function It defines the document header.
Attributes -
Contains <Title> tag
3. The TITLE Tag
TITLE Tag
Type Container Element
Function Define the document title.
Attributes -
Used Inside <HEAD>….</HEAD> tags
Problem: To display the web page title as ‘My First HTML Page’.
<HTML>
<HEAD>
<TITLE> My First Page </TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
4. The Body Tag
The body tag defines the document’s body. It contains all the contents of an
HTML document, such as text, images, lists, table, etc.
Attribute of Body Tag
1. Background attribute
This attribute allow you to include a background image.
<BODY background =”Pic.jpg”>
This above statement will set pic.jpg image as background of the body of
web page.
2. Background color, Text Color, Link Color
By default browsers display text in black.
If you want to change the color or text (by TEXT attribute), color of links (by
LINK attribute), color of active links (by ALINK attribute) and background color
(by BGCOLOR attribute ).
Consider the following:
<BODY bgcolor = “teal” text = “magenta” link = “yellow” alink = “red”>
- The background color is teal. (bgcolor = “teal”)
- Text color is magenta.
- Links that have not been visited recently are made yellow(link = “yellow”)
- Links that are currently being clicked on (alink = “lime”)