HTML - Copy
HTML - Copy
1
What is HTML
2
Creating HTML Files
3
How to save a file
File Name
.html
All Files
4
Creating HTML Document
Grammar
Tag
A tag is a code used in the HTML document
A tag is single-byte UPPERCASE/lowercase letters
enclosed by “<“ and “>”
<HTML> tag at the beginning of the document
</HTML> tag at the end of the document
5
HTML
Document
Header Body
Header is the starting Main contents of the HTML
section of the HTML document
document Tags related to the display of
Description of the name of the web page are contained
the web page is enclosed between the <BODY> tag and
between the <HEAD> tag the </BODY> tag
and the </HEAD> tag
6
Grammar of the Tag
Grammatically , they belong to any of the
patterns described follows
1 Basic Tag <TAG> .. </TAG>
For this type of tag an opening tag is used before a character string and a
closing tag is used after it.
7
Grammar of the Tag…
8
Grammar of the Tag…
3 Attribute Tag
<TAG attribute attribute ..> .. </TAG>
For this type of tag is used to specify attributes
within a tag for detailed specification
Depending on the type of tag, the attributes that
can be used are different.
Multiple attributes can be specified in random
order
Attributes are separated by a single-byte space.
Eg <BODY BGCOLOR=“#FFFFFF” BACKGROUND=“image.gif”>
…..</BODY>
10
To combine Font Attributes…
<FONT SIZE=“SPECIFY A SIZE” TYPE=“SPECIFY
A TYPE” COLOR=“SPECIFY A COLOR”> -
</FONT>
11
Displaying Text Data
<HTML> - </HTML>
These tags define the start and end of the HTML
Document
All the other tags are specified between them
<HEAD> - </HEAD>
These tags define the attribute of the HTML document
They form the header section of the HTML document
<TITLE> - </TITLE>
These tags define the title of the Web page
They are specified between <HEAD> - </HEAD>.
The title defined by these tags is shown on the title bar of
the browser.
<BODY> - </BODY>
These tags defined the body of the HTML document
12
<HTML>
<HEAD>
<TITLE>My First Web Page</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
13
Headings
These tags are used to display the
headings
The numbers indicate the levels of the
headings (Relative size) from 1-6)
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
14
Other Tags
<BR>
This tag is used to define line breaks <br/>
<!-- -- >
This tag is used to comment out line
Eg: <!-- table 1.1-->
15
Color Theory
Six digit hexadecimal numbers
RED GREEN BLUE
# RRGGBB
# ff0000 - RED
# 00ff00 - GREEN
# 000000 - BLACK
# ffffff - WHITE
Variation O~9 or a~f 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f 16
17
Text italic, bold and Underline
<I> - </I>
These tag is used to display italic text
Eg <I>My First Web Page</I>
<B> - </B>
These tag is used to display bold text
Eg <B>My First Web Page</B>
<U> - </U>
These tag is used to display underline text
Eg <U> My First Web Page</U>
18
Superscript subscript and Strike text
<SUP> - </SUP>
These tag is used to display Superscript text
Eg 2<SUP>nd</SUP> 2nd
<SUB> - </SUB>
These tag is used to display subscript text
Eg H<SUB>2</SUB> H2
<STRIKE> - </STRIKE>
These tag is used to display strike out text
Eg <STRIKE> My First Web Page</STRIKE>
My First Web Page
19
Paragraphs and Horizontal Rules
<P> - </P>
These tags define the paragraph
They force a line break and insert a blank line
before and after the paragraph.
<BODY>
<P> This is my first paragraph </p>
<BR> blockquote {
<P> This is my Second paragraph padding : 10px;
border : 1px solid #6395a5;
</p> background-color : #bfd5e2;
<BR> text-align : justify;
</BODY> font-style : italic;
}
<HR> - </HR>
This tag is used to display a border (horizontal
rule)
Attribute of the <HR> tag can specify the
thickness. Length, left and right alignment.
<HR WIDTH=”70%” ALIGN=“LEFT”>
21
LISTS
<OL> - </OL>
These tags are used to display the ordered list
They are used in combination with <LI> tag
<UL> - </UL>
These tags are used to display the unordered list
They are used in combination with <LI> tag
<LI>
This tag is used in the scope of the <OL> tags or the
<UL> tags described above for the display of a list
item.
One <LI> tag is used for each list item
22
LISTS …
<DL> - </DL>
These tags are used to display the definition list
They are used in combination with the <DT> and
<DD>tags described below
<DT> - </DT>
These tags are used in the scope of the <DL> tags
described above for the display of the definition
term. </DT> Can be omitted
<DD> - </DD>
These tags are used in the scope of the <DL>
tags described above for the display of
definition
The definition is displayed at an indent position
from the definition term. </DD> can be omitted
23
LISTS …
<DL>
<DT>HTML</DT>
<DD> HyperText Markup
Language</DD>
</DL>
24
TABLES
<TABLE> - </TABLE>
These tags define the table
They are used in combination with the <TR> and
<TH>
An attribute of the <TABLE>
<TABLE BORDER=“2”>
<TR> - </TR>
These tags define the rows of the table.
<TD> - </TD>
These tags define the data (cell) of the rows.
Adjust the Column width: <td width=100> - </td>
<TH> - </TH>
These tags define the Item names of the columns of the
table. 25
TABLES …
“ROWSPAN”
The “ROWSPAN” attribute that specifies a cells
spanning across multiple rows
<TD ROWSPAN=“number of row”> - </TD>
“COLSPAN”
The “COLSPAN” attribute specifies a cell across
multiple columns
<TD COLSPAN=“number of column”> - </TD>
<CAPTION>-</CAPTION>
These tags define the caption of the table
They are used between the <TABLE> tag and the
first <TR> tag
26
Displaying Image & Image Data
<IMG SRC=“image file name”>
This tag is used to display an image
“ALT”
The “ALT” attribute that specifies the character
strings to be displayed on a text based browser in
place of the image
<IMG SRC=“image name” ALT=“character string”>
27
Displaying Image & Image Data …
ALIGN
The “ALIGN” attribute that specifies the
alignment of the text to be displayed next to the
image.
<IMG SRC=“image name” ALIGN=“position of the
character string”>
(TOP, MIDDLE & BOTTOM)
28
Specifying Links
<A HREF=“file name”>-</A>
These tags are used to set up hyperlinks for
calling up other web pages.
A
document
<A HREF=“ ./C/ccc.html”>
ccc.html
•To reference a file in a folder above the
bbb.html current folder in the folder hierarchy (One
level up)
•To reference a file in a folder below the
current folder in the folder hierarchy then
just specify the name of the subfolder.
31
Links to the Same Page
<A HREF =“#anchor name(user defined name)”>-
</A>
– Eg <a href="#B">Part B</a>
These tags and the option assign a name to an
arbitrary position in the HTML document.
Using a link defined by the <A> tags described
next, the position specified by these tags can be
display at the beginning of the browser screen.
Anchor name can be any alphabets
Source Page:
◦ <a name=a><h1>Introduction</h1></a>
33
Example …(Link to the same Page)
34
Links to e-mail….
Others:
<A NAME =“mailto:e-mail address”>-</A>
Specifies an e-mail program to be started up
mailto protocol and the e-mail address as the URL with
the HRE attribute.
<ADDRESS>
<A HREF=“mailto:user00@flms.co.jp”>Development Team</A>
</ADDRESS>
35
Links to External Media Data
36
Image Map
What is an Image Map
The image map is a function that calls up another
Web page when any part of its image is clicked.
There are two ways to use this image map
function
– Client side Image Map
This method makes use of the tag function in the
HTML document
– Server side Image Map
This method makes use of the application
(CGI/SSI) on the WWW server to process data
37
Image Map cont…
<IMG SRC=“image file name” ALT=“Comment” USEMAP=“#name of the
map”>
These tags and the USEMAP attribute are used to display images
to be used as the image map.
<MAP NAME=“name of map”> - </MAP>
These tags are used to set up the image map
The <AREA> tags described below are specified in the scope of
these tags.
</MAP>
<AREA SHAPE=“shape” COORDS=“specify coordinates” HREF=“file
name or URL” ALT=“comment”> 38
Image Map cont…
<IMG SRC=“image file name” ALT=“Comment” USEMAP=“#name of
the map”>
These tags and the USEMAP attribute are used to display
images to be used as the image map.
Shapes: RECT CIRCLE POLY
<img>
(0,0)
(a,b) b (a,b)
(e,f)
a d (a,b)
C
(c,d) (c,d)
C
Shape=“rect” Shape=“circle” Shape=“poly”
Coords=“a,b,c,d” Coords=“a,b,c” Coords=“a,b,c,d,e,f”
(Centre & Radius)
<AREA SHAPE=“shape” COORDS=“specify coordinates”
HREF=“file name or URL” ALT=“comment”> 39
Using Forms
<FORM METHOD=“POST” ACTION=mailto:e-mail address
ENCTYPE=“text/plain”> - </FORM>
40
Text boxes
<INPUT TYPE=“TEXT” NAME=“textbox name” SIZE=“length of the
textbox”>
41
Pull-down Menus
<SELECT NAME=“pull-down Menu name”>-</SELECT>
These tags are used to define the pull down menu
They are used in combination with the following
<option> tags
They are described in the scope of the <FORM> tags.
An attribute of the “SELECT” tag can be set for
multiple items to be selected from the pull-down menu.
The “MULTIPLE” attribute that allows section of
multiple items
<SELECT NAME=“pull-down Menu name” MULTIPLE>-</SELECT>
The “SIZE” attribute that specifies the number of
items to be displayed in the list
<SELECT NAME=“pull-down Menu name” SIZE=“number of items”>-
</SELECT>
42
Pull-down Menus …
<OPTION> Item Name (Value to be sent)
43
Radio Button
<INPUT TYPE=“RADIO” NAME=“radio button
group name” VALUE=“value to be sent”>-
This tag defines the radio button (Exclusive input). It
is specified in the scope of the <FORM> tags
44
Checkboxes
<INPUT TYPE=“CHECKBOX” NAME=“checkbox
name”>
45
Input Areas
<TEXTAREA NAME=“name of the input area”
ROWS=“height of the input area” COLS=“width of
the input area”> - </TEXTAREA>
These tags define an input area that contains more
than 1 line of input
They are specified in the scope of the <FORM> tags
The character string described in the scope of the
<TEXTAREA> tags is displayed in the area as the
initial value
In the e-mail to be sent, it is described as “name of
input area=input sentences”
<TEXTAREA NAME=“message” ROWS=“5” COLS=“60”>
Please write your comments here
</TEXTAREA>
46
Send Button and Cancel Button
<INPUT TYPE=“SUBMIT” VALUE=“name of send
button”>
This tag and the attributes define the button for
sending input or selected data
Press this button and e-mail will be sent to the address
specified by the ACTION attribute of the <FORM> tag.
<INPUT TYPE=“RESET” VALUE=“name of cancel
button”>
This tag and the attributes define the button for
clearing the input data
<INPUT TYPE=“SUBMIT” VALUE=“Send”>
<INPUT TYPE=“RESET” VALUE=“Cancel”>
47
Frames
What is the Frame Function?
This function splits the browser screen into multiple
frames, which display separate web pages.
48
Frames …
<FRAMEST>-</FRAMEST>
These tags are used to define the split screen. In
the HTML file used for frame setting, these tags
are used in place of the <BODY> tags.
The method of split and the size of each frame are
set up in the options
The COLS attribute that splits the screen into left
and right frames
<FRAMESET COLS=“size of the left frame, size of the right
frame”> - </FRAMEST>
The ROWS attribute the split the screen into top and bottom
frames
51
Sample code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252"> <meta http-equiv="Content-Language" content="en-us">
<title>Main Entrance</title>
<!-- frames -->
<frameset rows="159,*" border="0">
<frame name="top" src="top.html" marginwidth="0" marginheight="0"
scrolling="no" frameborder="0“ noresize="noresize">
<frameset cols="159,*" border="0">
<frame name="left" src="left.html" marginwidth="0" marginheight="0"
scrolling="no" frameborder="0“ noresize="noresize">
<frame name="main" src="main.html" marginwidth="0" marginheight="0"
scrolling="auto" frameborder="0“ noresize="noresize">
</frameset>
</frameset>
</head>
<body>
<noframes>
</noframes>
</body>
</html> 52
Targeting frames
TARGET attribute. This attribute is not found in the
frame definition but is used within normal HTML
documents to direct data to specific frames
53
Frame target names
There are some special target names, called frame target
names. These all begin with an underscore ( _ ) and are used to
load pages into groups of frames.
_top The user agent should load the document into the
full, original window (thus canceling all other frames). This value is
equivalent to _self if the current frame has no parent
54
Send mail
<A HREF="mailto:e-mail address > - </A>
These tags define to send an e-mail to somebody
<A HREF="mailto:saman17lk@yahoo.com">saman</a>
55
Adding Multimedia Features to WWW
How to embed a Music file
<HTML>
<HEAD>
<TITLE>EMBEDED</TITLE>
</HEAD>
<BODY>
<EMBED SRC="MUSIC.MID" WIDTH="144" HEIGHT="60" PLAY="TRUE"
LOOP="TRUE" QUALITY="HIGH"> <!- -or- ->
<EMBED SRC="MUSIC.MID" WIDTH="144" HEIGHT="60" PLAY="TRUE"
LOOP=“-1” QUALITY="HIGH“ autostart=false>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>EMBEDED</TITLE>
</HEAD>
<BODY>
<EMBED SRC="SRILANKA.AVI" WIDTH="300" HEIGHT="350"
PLAY="TRUE" LOOP="TRUE" QUALITY="HIGH">
</BODY>
</HTML>
57
How to Create i-frame in HTML
<body>
<TABLE ALIGN=RIGHT BORDER=1 BGCOLOR="#FFFFCC">
<TR>
<TD><H4>Facts About Beavers</H4>
<UL>
<LI><A HREF=“habitat.html" TARGET="abc">Habitats</A>
<LI><A HREF=“food.html" TARGET="abc">Food</A>
<LI><A HREF=“health.html" TARGET="abc">Health</A>
</UL>
<IFRAME
NAME="abc"
SRC="Habitat.html"
WIDTH=300 HEIGHT=200>
</IFRAME></TD>
</TR></TABLE>
</body>
</html>
58
Browse a File
<body>
<!--forms then file field -->
<p>Insert your image:<input type=“file” name="as"></p>
</body>
59
Download a Word File (doc) or
PDF
60
HTML Standards….. for HTML Validation
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en"">
<head>
<title>On Going Events</title>
<link href="../css/default.css" rel="stylesheet" type="text/css"
title="Default" />
<link href="../css/black.css" rel="alternate stylesheet"
type="text/css" title="High Contrast" />
</head>
<body>
</body>
</html>
61
HTML <meta> Tag
Describe metadata within an HTML document
<head>
<meta name="description" content="Free Web tutorials" />
<meta name="keywords" content="HTML,CSS,XML,JavaScript" />
<meta name="author" content="Hege Refsnes" />
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
</head>
63
Markup Validation Service
v0.7.1
http://validator.w3.org/
64