Introduction to HTML
Introduction to HTML
What is HTML?
• HTML, otherwise known as HyperText
Markup Language, is the language used to
create Web pages
• Using HTML, you can create a Web page
with text, graphics, sound, and video
Tags
• the essence of html programming is tags
• a tag is a keyword enclosed by angle
brackets ( example: <i> )
• there are opening and closing tags for many
but not all tags; the affected text is between
the two tags
More Tags...
• The opening and closing tags use the same
command except the closing tag contains
and additional forward slash /
• For example, the expression <B>
Warning </B> would cause the word
‘Warning’ to appear in bold face on a Web
page
Nested Tags
• whenever you have html tags within other
html tags, you must close the nearest tag
first
• example:
<p> <b> the nation </b> </p>
Structure of a Web Page
• All Web pages share a <HTML>
<HEAD>
common structure <TITLE> Example </TITLE>
• All Web pages should </HEAD>
<BODY>
contain a pair of
This is where you would include
<HTML>, <HEAD>, the text and images on your Web
<TITLE>, and page.
</BODY>
<BODY> tags </HTML>
The <TITLE> Tag
• Choose the title of your Web page carefully;
The title of a Web page determines its
ranking in certain search engines
• The title will also appear on Favorite lists,
History lists, and Bookmark lists to identify
your page
Text Formatting
• Manipulating text in HTML can be tricky;
Oftentimes, what you see is NOT what you
get
• For instance, special HTML tags are needed
to create paragraphs, move to the next line,
and create headings
Text Formatting Tags
<B> Bold Face </B>
<I> Italics </I>
<U> Underline </U>
<P> New Paragraph </P>
<BR> Next Line
Headings
• Web pages are typically organized into
sections with headings; To create a heading
use the expression <Hn>….</Hn> where n
is a number between 1 and 7
• In this case, the 1 corresponds to the largest
size heading while the 7 corresponds to the
smallest size
Aligning Text
• The ALIGN attribute can be inserted in the
<P> and <Hn> tags to right justify, center,
or left justify the text
• For example, <H1 ALIGN=CENTER> The
New York Times </H1> would create a
centered heading of the largest size
Comment Statements
• Comment statements are notes in the HTML
code that explain the important features of
the code
• The comments do not appear on the Web
page itself but are a useful reference to the
author of the page and other programmers
• To create a comment statement use the
<!-- …. --> tags
The Infamous Blink Tag
• It is possible to make text blink using the
<BLINK> … </BLINK> tag
• However, it is best to use this feature at
most sparingly or not at all; What seems
like a good idea to a Web designer can
become very annoying to a Web user
• The <BLINK> tag is not supported by
Internet Explorer
Page Formatting
• to define the background color, use the
bgcolor attribute in the <body> tag
• to define the text color, use the text attribute
in the <body> tag
• to define the size of the text, type <basefont
size=n>
Example
<html>
<head>
<title> example </title>
</head>
<body bgcolor=“black” text=“white”>
<basefont size=7>
this is where you would include the text and images on your web page.
</body>
</html>
Inserting Images
• Type <img src= “image.ext”>, where
image.ext indicates the location of the
image file
• The width=n and height=n attributes can be
used to adjust the size of an image
• The attribute BORDER=n can be used to
add a border n pixels thick around the image
Alternate Text
• Some browsers don’t support images. In
this case, the ALT attribute can be used to
create text that appears instead of the image.
• Example:
<img src=“satellite.jpg” alt = “Picture of
satellite”>
Links
• A link lets you move from one page to
another, play movies and sound, send email,
download files, and more….
• A link has three parts: a destination, a
label, and a target
• To create a link type
<a href=“page.html”> label </a>
Anatomy of a Link
<a href=“page.html”> label </a>
Drop-down Menu
Radio Buttons
Checkboxes
Text Area
Reset Button
Submit Button
The Form Shell
• A form shell has three important parts:
– the <FORM> tag, which includes the address
of the script which will process the form
– the form elements, like text boxes and radio
buttons
– the submit button which triggers the script to
send the entered information to the server
Creating the Shell
• To create a form shell, type <FORM
METHOD=POST ACTION=“script_url”>
where “script_url” is the address of the
script
• Create the form elements
• End with a closing </FORM> tag
Creating Text Boxes
• To create a text box, type <INPUT
TYPE=“text” NAME=“name”
VALUE=“value” SIZE=n
MAXLENGTH=n>
• The NAME, VALUE, SIZE, and
MAXLENGTH attributes are optional
Text Box Attributes
• The NAME attribute is used to identify the
text box to the processing script
• The VALUE attribute is used to specify the
text that will initially appear in the text box
• The SIZE attribute is used to define the size
of the box in characters
• The MAXLENGTH attribute is used to
define the maximum number of characters
that can be typed in the box
Example: Text Box
First Name: <INPUT • Here’s how it would
TYPE="text"
NAME="FirstName" look on the Web:
VALUE="First Name"
SIZE=20>
<BR><BR>