Professional Documents
Culture Documents
1
HTML File
HTML stands for Hyper Text Markup Language
An HTML file is a text file containing small markup
tags
The markup tags tell the Web browser how to
display the page
An HTML file must have an htm or html file
extension
An HTML file can be created using a simple text
editor
HTML File
HTML tags are surrounded by the two characters <
and >
The surrounding characters are called angle brackets
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is
the end tag
The text between the start and end tags is the element
content
HTML tags are not case sensitive, <b> means the
same as <B>
HTML Page Format
<HTML>
<HEAD>
<TITLE> First Web Page </TITLE>
</HEAD>
<BODY>
<H1> Hello World </H1>
<! Rest of page goes here. This is a comment. >
</BODY>
</HTML>
4
HEAD ELEMENTS
The <head> tag is supported in all major
browsers.The head element contains general
information, also called meta-information, about a
document .
Meta-information means information about
information.
The elements inside the head element should not be
displayed by a browser.
According to the HTML standard, only a few tags are
legal inside the head section. These are: <link>,
<title>, <style>, and <script>.
TITLE TAG
The <title> tag defines the title of the document.
The title element is required in all HTML documents.
The title element:
1. defines a title in the browser toolbar
2. provides a title for the page when it is added to
favorites
3. displays a title for the page in search-engine
results
<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>
Tag Attributes
11
HTML <h1> to <h6> tags
13
Headings
<HTML>
<HEAD>
<TITLE>Document Headings</TITLE>
</HEAD>
<BODY>
Samples of the six heading types:
<H1>Level-1 (H1)</H1>
<H2 ALIGN="center">Level-2 (H2)</H2>
<H3>Level-3 (H3)</H3>
<H4 ALIGN="right">Level-4 (H4)</H4>
<H5>Level-5 (H5)</H5>
<H6>Level-6 (H6)</H6>
</BODY>
</HTML>
14
<P> Paragraph
<P> defines a paragraph
Add ALIGN="position" (left, center, right)
Multiple <P>'s do not create blank lines
Use <BR> for blank line
Fully-specified text uses <P> and </P>
But </P> is optional
15
<BODY>
<P>Here is some text </P>
<P ALIGN="center"> Centered text </P>
<P><P><P>
<P ALIGN="right"> Right-justified text
<! Note: no closing /P tag is not a problem>
</BODY>
16
<PRE> Preformatted Text
<PRE>
if (a < b) {
a++;
b = c * d;
}
else {
a--;
b = (b-1)/2;
}
</PRE>
17
Special Characters
Character Use
< <
> >
& &
" "
Space
18
Colors
Values for BGCOLOR and COLOR
many are predefined (red, blue, green, ...)
all colors can be specified as a six character hexadecimal
value: RRGGBB
FF0000 – red
888888 – gray
004400 – dark green
FFFF00 – yellow
19
Fonts
<FONT COLOR="red" SIZE="2" FACE="Times Roman">
This is the text of line one </FONT>
<FONT COLOR="green" SIZE="4" FACE="Arial">
Line two contains this text </FONT>
<FONT COLOR="blue" SIZE="6" FACE="Courier"
The third line has this additional text </FONT>
25
Ordered (Numbered) Lists
<OL TYPE="1">
<LI> Item one </LI>
<LI> Item two </LI>
<OL TYPE="I" >
<LI> Sublist item one </LI>
<LI> Sublist item two </LI>
<OL TYPE="i">
<LI> Sub-sublist item one </LI>
<LI> Sub-sublist item two </LI>
</OL>
</OL>
</OL> 26
Unordered (Bulleted) Lists
<UL TYPE="disc">
<LI> One </LI>
<LI> Two </LI>
<UL TYPE="circle">
<LI> Three </LI>
<LI> Four </LI>
<UL TYPE="square">
<LI> Five </LI>
<LI> Six </LI>
</UL>
</UL>
28
</UL>
Definition Lists
32
The <a> tag is used to create an anchor to link from, the href
attribute is used to address the document to link to, and
the words between the open and close of the anchor tag
will be displayed as a hyperlink.
This anchor defines a link to W3Schools:
<a href="http://www.w3schools.com/">Visit W3Schools!
</a>The line above will look like this in a browser:
Visit W3Schools
33
The name attribute is used to create a named
anchor. When using named anchors we can create
links that can jump directly into a specific section
on a page
<a name="label">Text to be displayed</a>
<a name="tips">Useful Tips Section</a>
<a href="#tips">Jump to the Useful Tips
Section</a>
Hyperlinks
<BODY>
<H3>Welcome to <A HREF="http://www.cs.virginia.edu">
<STRONG>Computer Science</STRONG></A>
at the <A HREF="www.virginia.edu">University of Virginia.</A>
</H3>
</BODY>
35
Images
SRC is required
WIDTH, HEIGHT may be in units of pixels or
percentage of page or frame
WIDTH="357"
HEIGHT="50%"
Images scale to fit the space allowed
36
Images
37
Images
<BODY>
<img src="dolphin.jpg" align="left" width="150" height="150"
alt="dolphin jump!">
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
This is a very cute dolphin on the left!<br>
You can see text wrap around it<br>
</BODY> 38
</HTML>
ALIGN="left"
39
ALIGN="right"
40
ALIGN=“bottom"
41
Mapping
There are two types of mapping:
Client side mapping (all the pages that are to be opened are
at the client side terminal.)
Server Side mapping (all the pages are to be connected
through the server.)
The regions that are selected for hyperlinks in an image is
called as HOT SPOT or HOT REGION.
ISMAP is the attribute when we create SERVER SIDE
MAPPING
USEMAP is the attribute when we create CLIENT SIDE
MAPPING
HTML <map> tag
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm"
alt="Sun" />
<area shape="circle" coords="90,58,3" href="mercur.htm"
alt="Mercury" />
<area shape="circle" coords="124,58,8" href="venus.htm"
alt="Venus" />
</map>
HTML <area> tag
47
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Tables
49
<colgroup>
Defines groups of table columns
<col>
Defines the attribute values for one or more columns
in a table
<thead>
Defines a table head
<tbody>
Defines a table body 50
Tables
<TABLE BORDER=1>
<CAPTION>Table Caption</CAPTION>
<TR><TH>Heading1</TH> <TH>Heading2</TH></TR>
<TR><TD>Row1 Col1 Data</TD><TD>Row1 Col2 Data</TD></TR>
<TR><TD>Row2 Col1 Data</TD><TD>Row2 Col2 Data</TD></TR>
<TR><TD>Row3 Col1 Data</TD><TD>Row3 Col2 Data</TD></TR>
</TABLE>
51
cellspacing=10
cellpadding=10
52
<TABLE> Element Attributes
BGCOLOR=color -- background color of table, also valid
for <TR>, <TH>, and <TD>
RULES=value -- which internal lines are shown; values are
none, rows, cols, and all (default)
53
<TR> Table Row Attributes
Valid for the table row:
ALIGN -- left, center, right
VALIGN -- top, middle, bottom
BGCOLOR -- background color
58
<frameset cols="25%,75%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
</frameset>
Frames
MARGINWIDTH – left/right margins
MARGINHEIGHT – top/bottom margins
SCROLLING – yes or 1 adds scroll bar
NORESIZE – yes or 1 disables resizing
60
Style Sheets
Style sheets make it easy to specify the amount of white
space between text lines, the amount lines are indented,
the colors used for the text and the backgrounds, the font
size and style, and a host of other details.
Style sheets allow style information to be specified in many
ways.
Styles can be specified:
• inside an HTML element
• inside the head section of an HTML page
• in an external CSS file
61
What is CSS?
66
CSS
H1 {text-align: center;
color: blue;
font: Arial, Times New Roman}
P {text-align: left;
color: red;
font-family: Tahoma, Arial Narrow;
font-style: italics}
67
Fizzics1 (no style sheet)
<HTML>
<HEAD>
<TITLE>New Advances in Physics</TITLE>
</HEAD>
<BODY>
<H1>New Advances in Physics</H1>
<H2>Turning Gold into Lead</H2>
In a startling breakthrough, scientist B.O. "Gus" Fizzics
has invented a <STRONG>practical</STRONG> technique for
transmutation! For more details, please see
<A HREF="give-us-your-gold.html">our transmutation thesis</A>.
...
</BODY>
</HTML>
68
From: Core Web Programming, Marty Hall and Larry Brown, © 2002