Professional Documents
Culture Documents
Lecture3 IntroductionToWebPages
Lecture3 IntroductionToWebPages
Lecture 3
INTRODUCTION TO WEB
PAGES & HTML
© 2009, DCST
PGDCET/NWT Department of Computer Science & Technology
Objectives
• To understand what a web page is
• Elements of a web page
• To understand what is HTML
• HTML elements and attributes
• Types of HTML elements
• Document structure elements
• Create and modify HTML documents using a
simple text editor
• Tips on HTML
Web Page
• A document or resource of information
• Suitable for the World Wide Web
• Accessed and displayed through a web
browser
• May provide navigation to other web
pages via hypertext links or hyperlinks
Web Terminology
• The World Wide Web
─ The set of computers on the Internet that support HTTP
─ Not a separate network
• HTTP
─ HyperText Transfer Protocol
─ The protocol used by a WWW client (eg. Internet Explorer)
to request documents from a WWW server (i.e. the
program running at websites like yahoo.com or
amazon.com)
• HTML
─ HyperText Markup Language
─ The language used to design web pages
Web Page...
Web pages may be
• Static web pages
– Consist of files of static content stored
within the web server's file system
What is HTML?
• HTML is a language for describing web pages
• HTML stands for Hyper Text Markup
Language
• HTML is not a programming language, it is a
markup language
• A markup language consists of a set of
markup tags
• HTML uses markup tags to describe
elements on a web pages
HTML Tags
• HTML tags are keywords surrounded by
angle brackets like <html>
• HTML tags normally come in pairs like
<b> and </b>
• The first tag in a pair is the start or
opening tag, the second tag is the end
or closing tag
HTML Documents
• A HTML document corresponds to a web
page
• HTML documents contain HTML tags and
plain text
• A web browser (like Internet Explorer or
Firefox) reads HTML documents and displays
them as web pages
• The browser does not display the HTML tags,
but uses the tags to interpret the content of
the page
A Simple Example
• The text between <html> and
<html> </html> describes the web
page
<body>
• The text between <body> and
<h1>My First Heading</h1> </body> is the visible page
content
<p>My first paragraph</p>
• The text between <h1> and
</body> </h1> is displayed as a
heading
</html>
• The text between <p> and
</p> is displayed as a
paragraph
HTML Elements
• An HTML element indicates structure in an
HTML document and a way of hierarchically
arranging content
• Elements may represent headings,
paragraphs, hypertext links, lists, embedded
media and a variety of other structures
HTML Elements...
• HTML elements have properties:
attributes and content
– Attributes define desired behavior or
indicate additional element properties
– Content can be text or other elements
Element Attributes
• Attributes provide additional information
about the element
• Attributes are always specified in the
start tag
• Attributes come in name/value pairs
like: name="value"
e.g. <p align="left">, <hr color="pink">
HTML Elements...
HTML elements may be either containers or empty
• Container elements are constructed with:
– A start tag (<tag>) marking the beginning of an element, which may
incorporate any number of attributes (including their values)
– Some amount of content (text, other elements)
– An end tag </tag>, in which the element name is prepended with a
forward slash
Most HTML elements can be nested (i.e. can contain other HTML
elements)
<html>
<body>
<h2 align="center">Weak monsoon depletes India's water
reservoirs </h2>
<p align="left">Water levels in <b><font color="red">
India's 81 main reservoirs </font><i>have more than</i>
halved from a year </b> earlier after the lowest June
monsoon rains for 83 years, government data showed on
Thursday. </p>
<hr color="pink">
</body> empty tag content – text or
</html> other elements
Note: Tags must be properly nested
PGDCET/NWT Department of Computer Science & Technology
• <html>...</html>
– The Root element of an HTML document; all other
elements are contained in this
• <head>...</head>
– Container for processing information and
metadata for an HTML document
• <body>...</body>
– Container for the displayable content of an HTML
document
<html>
<head>
<title> Background picture </title>
</head>
<body background="Sunset.jpg">
The background is a picture
</body>
</html>
HTML Colours
• Colors are displayed combining RED, GREEN, and
BLUE light.
• HTML colors are defined using a hexadecimal (hex)
notation 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 (hex 00). The highest value is 255 (hex
FF).
• Hex values are written as 3 double digit numbers,
starting with a # sign.
• Most modern monitors are capable of displaying at
least 16384 different colors.
102 66 OR
– Its hexadecimal
153 99 value
• "#3366ff","#000000"
204 CC
255 FF
HTML Tips
• How to View HTML Source
– Click the VIEW option in browser's toolbar and
select SOURCE or PAGE SOURCE.
– This will open a window that shows the HTML
code of the page
HTML Tips...
• Always quote attribute values
– Double style quotes are the most common, but single style
quotes are also allowed.
– In some rare situations, like when the attribute value itself
contains quotes, it is necessary to use single quotes:
eg. name='John "IronMan" Nelson'
Summary
• A web page is a resource of information
• A web page can contain numerous types of
information: text, image, audio, video
• HTML is a markup language used to describe
web pages
• Most HTML tags are containers that require a
matching closing tag
• The opening tag usually has a number of
attributes that modify the tag in some way
Summary
Tag Explanation
<html> Identifies HTML content
<head> Contains metadata information
about the web page
<title> Displayed in the title bar of the
browser
<body> HTML body comprising of the
visual aspects of the page