Basic HTML Advanced HTML
HTML documents are in plain text format and can be created using any text editor

Sample HTML Document


<HTML>
<HEAD>
<TITLE>Demo page</TITLE>
<!--Created by: wingky chan, jul 8, 2002 -->
</HEAD>
<BODY>
<H1>Demo page</H1>
HTML document are in plain text format and can be created
using any text editor.<p>
</BODY>
</HTML>

HTML uses markup tags to tell Web browser how to display text HTML tags are usually paired --

<H1>and</h1>

<H1>tells Web browser to start formatting level-one heading

</H1>tells browser that heading is complete

Sample exception to pairing rule is <p>(paragraph) tag

Note: HTML is not case sensitive.<title>is equivalent to <TITLE> or <TiTlE>
<! -- text --> is comment in HTML source and is not displayed on the page. not all tags are supported by all Web browser. if browser does not support tag, it just ignores it.

Every HTML document should have title used primarily for document identification

HTML has six levels of headings, numbered 1 through 6, with 1 being most prominent


<Hy>Text of heading </Hy>
where y is number between 1 and 6
In many documents, first heading is identical to title
 
ALIGN attribute can be used to explicitly specify horizontal alignment
 
ALIGN=LEFT -- Heading is flush left (default)
ALIGN=CENTER -- heading is centered
ALIGN=RIGHT -- heading is flush right
Web browsers ignore multiple spaces, line breaks, and starts new paragraph only when it reachs <P> tag

Browsers ignores any indentations or blank lines in source text.
However, to preserve readability in HTML files, headings should be on separate lines, and paragraphs should be separated by blank lines (in addition to <P> tags)

Orginally <P> tag was un-matched and used at end of paragraph

Newer version can be used with matching <P> ... </P> tags

With newer version ALIGN attribute can be used

<P> ... </P>

same as

<P ALIGN=LEFT> ... </P>
<P ALIGN=CENTER> ... </P>
<P ALIGN=RIGHT> ... </P>

This crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river. This victory, along with that at Gattysburg, Pennsylvania, (July 1-3, 1863) titled the war in favor of the North.

The chief power of HTML comes from its ability to link regions of text (and also images) to another document. The browser highlights these regions (usually with color blue and underlines) to indicate that they are hypertext links

HTML's single hypertext-related tag is <A>, which stands for anchor
To include anchor with<A

Specify document that's being pointed to by entering parameter HREF="filename" followed by closing right angle bracket >

Enter text that will serve as hypertext link in current document.

Enter ending anchor tag: </A>

<A HREF="matinstats.html">Matin</A>

matinstats.html is in the same directory as the first document.

Link to documents in other directories by specifying relative path from current document to linked document.

<A HREF="atlandstats/lands.html">New Join</A>

These are called relative links.

In general, you should use relative links, because...
  • They are shorter
  • It's easier to move group of documents to another location, because relative path names will still be valid

Use absolute pathnames when linking to documents that are not directly related, such as entriely different websites.

Uniform Resource Locators (URLs) specify location of files on other servers.

scheme://host.domain[:port]/path/filename

where scheme is one of:

http file on World Wide Web server
gopher file on Gopher server
news an Usenet newsgroup

port number can generally by omitted

<A HREF="http://www.cbs.com/dave/schedule.html">
Late Night Schedule for December</A>

www is usually alias -- www.cbs.com might be alias for bigeye.cbs.com

For security, www alias usually maps to specific directory
www.cbs.com goes to www.cbs.com/public/.www

mentor.cc.purdue.edu/~jonesdr goes to /home/mentor/a/jonesdr/WWW

Link to directory is to default file in that directory -- Welcome.html, welcome.html, index.html, homepage.html

http://www.cbs.com -->http://www.cbs.com/index.html which is really www.cbs.com/public/.www/index.html

http://mentor.cc.purdue.edu/~jonesdr
--> http://mentor.cc.purdue.edu/~jonesdr/welcome.html which is really /home/mentor/a/jonesdr/WWW/welcome.html

To make a link that sends e-mail...

Please send any comments or sugestions to
<A HREF="mailto:info@canlink.com">the instructor</A>

Which looks like this ... Please send any comments or suggestion to the instructor.

Anchors can also be used to move to particular section in document. Set link from document A to specific section in document B:

Set up named anchor in document B

Here's <A NAME="history">some text</A>

Create link in document A, include not only filemane, but also named anchor, separated by hash mark (#)

This is my <A HREF="documentB.html#history">link</A> to document B

Links to Specific Section Within Current Document

This is a <A HREF="#history">link</A> from within document B

Start with opening list <UL> tag.

Enter <LI> tag followed by individual item. (No closing </LI> tag is needed.)

End with closing list </UL> tag.

<UL>
<LI> apples
<LI> bananas
</UL>

  • apples
  • bananas

Numbered list (also called ordered list) uses <OL> instead of <UL>. Items are tagged using same <LI> tag.

<OL>
<LI> oranges
<LI> peaches
<LI> grapes
</OL>

    1. oranges
    2. peaches
    3. grapes

<OL> is the same as <OL TYPE=1>(Arabic numbers)

<OL TYPE=A> (capital letters)
<LI> oranges
<LI> peaches
<LI> grapes
</OL>

    A. oranges
    B. peaches
    C. grapes

<OL TYPE=a> (small letters)
<LI> oranges
<LI> peaches
<LI> grapes
</OL>

    a. oranges
    b. peaches
    c. grapes

<OL TYPE=I> (Large Roman numerals)
<LI> oranges
<LI> peaches
<LI> grapes
</OL>

      I. oranges
     II. peaches
    III. grapes

<OL TYPE=i> (Small Roman numerals)
<LI> oranges
<LI> peaches
<LI> grapes
</OL>

      i. oranges
     ii. peaches
    iii. grapes

Definition list usually consists of alternating term (abbreviated as DT) and definition (abbreviated as DD)

<DL>
<DT> NCSA
<DD> NCSA, National Center for Supercomputing Applications, is located on campus of University of Illinois at Urbana-Champaign. NCSA is one of participants in National MetaCenter for Computational Science and Engineering.
<DT> Cornell Theory Center
<DD> CTC is located on campus of Cornell University in Ithaca, New York. CTC is another participant in National MetaCenter for Computational Science and Engineering.
</DL>

NCSA

    NCSA, National Center for Supercomputing Applications, is located on campus of University of Illinois at Urbana-Champaign. NCSA is one of participants in National MetaCenter for Computational Science and Engineering.

Cornell Theory Center

    CTC is located on campus of Cornell University in Ithaca, New York, CTC is another participant in National MetaCenter for Computational Science and Engineering.

<UL>
<LI> few New England states:
      <UL>
      <LI> Vermont
      <LI> New Hampshire
      </UL>
<LI> One Midwestern state:
      <UL>
      <LI> Michigan
      </UL>
</UL>

  • few New England states:
    • Vermont
    • New Hampshire
  • One Midwestern state:
    • Michigan

Use the <PRE> tag (which stands for "preformatted") to generate text in fixed-width font and cause spaces, new lines, and tabs to be significant

<PRE>
#!/bin/csh
cd $SCR
cfs get mysrc.f:mycfsdir/mysrc.f
cfs get myinfile:mycfsdir/myinfile
fc -02 -o mya.out mysrc.f
mya.out
cfs save myoutfile:mycfsdir/myoutfile
rm *
</PRE>

#!/bin/csh
cd $SCR
cfs get mysrc.f:mycfsdir/mysrc.f
cfs get myinfile:mycfsdir/myinfile
fc -02 -o mya.out mysrc.f
my.out
cfs save myoutfile:mycfsdir/myoutfile
rm *

Hyperlinks can be used with <PRE> sections.

Start with <tag>, where tag is desired formatting tag, to indicate beginning of tagged text.

Enter tagged text

End passage with </tag>

<B> Bold text -- Be Prepared
<I> Italic text -- Semper Fidelis
<CODE>
    for snippets of computer CODE -- The iostream.h header file. (Displayed
    in fixed-width font.)
<SUP>
    SUPerscript (exponent) -- X2
<SUB>
    SUBscript --ai
<STRIKE>
    STRIKE-through style -- Please don't drink and drive
<U>    Underline --Pegasus was named for the winged horse. (Don't use this. It looks too much like a hyperlink!)

<BIG>
    BIGger font -- When the hammer hit her thumb, she screamed in agony.

<SMALL>
    SMALLer font -- Across the room he caught a glimpse of a tiny little mouse heading
    toward.

Four characters left angle bracket(<), right angle bracket(>), ampersand (&) and double quote (") have special meaning within HTML and therefore cannot be used "as is" in text.
To use one of these characters in HTML document, you must enter its special character sequence instead:

&lt;        special character sequence for <
&gt;       special character sequence for <
&amp;    special character sequence for &
&quot;    special character srquence for "
&#64;     special character sequence for @
&#169;   special character sequence for ©
&copy;   special character sequence for ©
&#174;   special character sequence for ®
&reg;      special character sequence for ®
&nbsp;   special character sequence for non-breaking space

&nbsp; intended to keep words together on a line

"Elwood&nbsp;Scuggins" will appear as

Elwood Scuggins on one line

&nbsp; can be used to create spaces that the browser does not ignore

For example, "one two&nbsp;&nbsp;&nbsp;three" will appear as

one two   three

To make an indented paragraph...

&nbsp;&nbsp;&nbsp;&nbsp;It was a dark and stormy night."will appear as

    It was a dark and stormy night. Sam Slade pulled his old rattle-trap Ford up to the curb when he saw the light in the apartment window.

<HR> tag produces horizontal line width of browser window
Default is shaded engraved line


<HR SIZE=number> -- how thick is horizontal rule to be.


<HR WIDTH=number/percent> -- Default horizontal rule is always as wide as page. With WIDTH tag, author can specify exact width in pixels, or relative width measured in percent of document width.


<HR ALIGN=LEFT/RIGHT/CENTER> -- For small rules, pushed up against left margin, right margin, or centered on page.


<HR NOSHADE> -- for those times when you really want a solid bar.


In following list, those extensions in red can be displayed "in-line" by most Web browsers -- no need to invoke "helper" program

HTML document
    .html or .htm
Plain text
    .txt
PostScript file
    .ps or.eps
Portable BitMap (PBM) image
    .pbm
Portable GrayscaleMap (PGM) image
    .pgm
Portable PixMap (PPM) image (full color)
    .ppm
Portable aNyMap (PNM) image (all 3 above)
    .pnm
Tagged Image File Format (TIFF) image
    .tiff or.tif
X BitMap (XBM) image
    .xbm
Graphics Interchange Format (GIF) image
(pronounced like the peanut butter)
    .gif
Joint Photographic Experts Group (JPEG) image
    .jpeg or .jpg
Portable Network Graphics (PNG) image
(pronounced "ping" -- gif alternative started when CompuServe implied it might want royalties on all gif images)
    .png

AUdio(AU) sound (UNIX)
    .au
Audio Interchange File Format (AIFF) sound (Macintosh)
    .aiff or.aif
WAVE (Windows)
    .wav
RealAudio (Windows, Macintosh, UNIX)
    .ra or .ram
Moving Picture Expert Group (MPEG) move (UNIX, Windows)
    .mpeg or .mpg
QuickTime MOVie (Macintosh, Windows)
    .mov
Audio Visual Interleave (AVI) for digital video and audio (Windows, Macintosh)
    .avi

Netscape allows specification of images's width and height in pixels.

<IMG SRC="images/mon.gif" WIDTH=400 HEIGHT=300>

Do this for speed, the browser will leave the right amount of space for image, but will continue laying out document with hole into which image will be placed.

WIDTH and HEIGHT values that differ from the actual width and height of image will cause the image to be scaled to fit the given dimensions. Be sure to use width and height that have same ratio as actual image or you will get strange images.

<IMG SRC="images/mon.gif" WIDTH=200 HEIGHT=150>

<IMG SRC="images/mon.gif" WIDTH=600 HEIGHT=450>

Can also use percentages

<IMG SRC="images/mon.gif" WIDTH=50% HEIGHT=75%>

Netscape will display image 50% as wide as screen size and 75% as high as screen size. You can specify ONLY width or height.Netscape will scale other dimension appropriately and display the image.

<IMG SRC="images/mon.gif" WIDTH=100>

will display smaller (but appropriately scaled) image 100 pixels wide.

<IMG SRC="images/mon.gif" HEIGHT=75%>

will display larger (but appropriately scaled) image 75% as high as screen size browser other than Netscape may ignore WIDTH and HEIGHT attributes.

IMG tag also has LOWSRC attribute

<IMG SRC="slow.gif" LOWSRC="fast.gif" WIDTH=400 HEIGHT=200>

Most browser recognize LOWSRC
Those that do not just ignore it and load normal SRC image
LOWSRC image loaded on "first pass" through document
when all text and all LOWSRC images loaded, SRC images loaded on "second pass" through document
LOWSRC can be "low resolution" small (fast loading) image file
SRC can be "high resolution" large(slow loading) image file
.gif and .jpeg images can be used for either LOWSRC or SRC and can be mixed
WIDTH and HEIGHT attributes used for both LOWSRC and SRC

if no WIDTH and HEIGHT attributes given, size of LOWSRC is used for SRC.

why? The "Hole" in the document for the image is determine by the size of the first image.

A standard feature of GIF image format is the option to store image data in the GIF file in an interlaced fashion.

Instead of storing an image's scan lines in exact sequence, equally spaced nonadjacent sets of lines are store together.

Most Web browsers (not limited to Netscape) display both normal and interlaced GIFs properly.

Interlaced GIF images appear to "fade in" from fuzzy to sharp focus.

Example of Normal and Interlaced Images

ppmtogif has a -interlace option

Can convert an existing GIF to an interlaced GIF as follows...

cat mom.gif | giftopnm | ppmtogif =interlace > newmom.gif

JPEG images may be turned into p-JPEG (progressive-JPEG) images that do the same thing.

A .gif can have more than one image per file.

When it does, it becomes a slide show presentation or animation.

GIF89a Specification

Examples of Animated GIF Images

The newest Microsoft Internet Explorer display multiple images in a single .gif file

A .gif"image" can contain several separate images, information on timing, and whether or not to "loop" the animation

Multiple images can be used along with transparency

Simple to use -- Just imbed the image inline via
<IMG SRC="images/sylvester.gif">

Much simple than Java or Shockwave animations

Tools are available to combine multiple .gif images into one "animated .gif"

WARNING: Browsers that cannot display multiple .gif images will usually display only the first of the first of the set -- which may not be very meaningful!

By default aligns text with bottom of images.
<IMG ALIGN=BOTTOM SRC=image_URL>

ALIGN=TOP aligns text with top of image
<IMG ALIGN=TOP SRC=image_URL>

ALIGN=MIDDLE aligns text with center of image
<IMG ALIGN=MIDDLE SRC=image_URL>


With ALIGN=LEFT,graphic will float down and over to current left margin, and subsequent text will wrap around right hand side of graphic until
<BR CLEAR=LEFT>


With ALIGN=RIGHT,graphic will float down and over to current right margin, and subsequent text will wrap around left hand side of graphic until
<BR CLEAR=RIGHT>


HSPACE and VSPACE leave horizontal and vertical white space between the image and things around it
<IMG SRC=image_URL HSPACE=80>

To use an image as a hyperlink, put the image source code inside the hyperlink code.

<A HREF="http://www.mainlink.com/file.html">
<IMG SRC="images/islink.gif"></A>



To avoid the link border, set BORDER=0

<A HREF="http://www.mainlink.com/file.html">
<IMG SRC="images/islink.gif" BORDER=0></A>

An image that is to be used as background for document

Used to tile full background of document-viewing are
<BODY BACKGROUND="metal/mainalig.gif">
....Document here...
</BODY>

BGCOLOR ATTRIBUTE

Change the color of the background without having to specify separate image that requires another network access to load.<BODY BGCOLOR="color">Document here</BODY>

Where "color" is "#RRGGBB" hexadecimal red-green-blue (RGB) triplet or a color name

RGB color value consists of three two-digit hexadecimal numbers (00-FF)

Each two-digit value specifies intensity of corresponding color

Color value#FF0000 is red because red number is set to highest value with green and blue set to zero

The Pound sign(#) is optional -- but is generally used with RGB values.

16 "primary" color names:

Aqua  Black  Blue  Fuchsia  Gray  Green  Lime  Maroom  
Navy  Olive  Purple  Red  Silver  Teal  White  Yellow

These color display as:
Aqua  Black  Blue  Fuchsia  Gray  Green  Lime  Maroom  
Navy  Olive  Purple  Red  Silver  Teal  White  Yellow

Curiously color name RED and value #FF0000 are the same

Color name BLUE and value #0000FF are the same

BUT, color name GREEN and value #00FF00 are NOT the same -- probably because #00FF00 looks more like LIME


TEXT ATTRIBUTE To control the color of all normal text in a document:

<BODY TEXT="color">Document here</BODY>

LINK, VLINK, AND ALINK, ATTRIBUTE

VLINK stands for visited link, and ALINK stands for active link. Default coloring of these is LINK="BLUE", VLINK="PURPLE", and ALINK="RED".

<BODY LINK="color" VLINK="color" ALINK="color">Document here</BODY>

<BODY BGCOLOR="BLACK" TEXT="#F0F0F0 LINK="YELLOW" VLINK=#22AA22" ALINK="#0077FF">

<FONT SIZE=value>...</FONT>

Can change font size. Valid values range from 1-7. Default FONT SIZE is 3. Value given to size can optionally have a '+'or'-' in front of it to specify that it is relative to document BASEFONT. Default BASEFONT is 3.
This is <FONT SIZE=+3>
This is <FONT SIZE=+1>
This is <FONT SIZE=-2>
<FONT SIZE=+1> is the same as <BIG>
<FONT SIZE=-1> is the same as <SMALL>

<FONT COLOR=color>...</FONT>

Can change font color. "Color" is "#rrggbb" hexadecimal red-green-blue triplet or a color name used to specify color.

This is <FONT COLOR="BLUE">

<FONT FACE=face>...</FONT>

<FONT FACE="face1,face2, ... ,facen"> ... </FONT>

Can change font face. Specify one or more font faces to use (in preference order). If none are available, standard face (usually "Times") will be used.

This may be <FONT FACE=Utopia>

Can change any combination of the three.

<FONT FACE=value(s) SIZE=value COLOR=color>...</FONT>

We advise you to use<FONT FACE="Helvetica,Utopia" SIZE=+3 COLOR="RED">extreme caution</FONT> when handling sulfuric acid.
We advise you to use extreme caution when handling sulfuric acid.

Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=2>
<TR>
<TD>Hong Kong</TD> <TD>75</TD> <TD>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD> <TD>1254</TD> <TD>Country</TD>
</TR>
</TABLE>


Table begin with <TABLE...>tag and end with </TABLE> tag

By default, tables have no borders or same effect via BORDER=0
Hong Kong75S.A.Region
China1254Country


<TABLE BORDER=0>
<TR>
<TD>Hong Kong</TD> <TD>75</TD> <TD>Region</TD>
</TR>
<TR>
<TD>China</TD> <TD>1254</TD> <TD>Country</TD>
</TR>
</TABLE>


<TR...></TR> stands for table row
<TD...></TD> stands for table data, and specifies standard table data cell. Each row need not have same number of cells specified. Short rows will be padded with blank cells on the right. Default alignment of table data is ALIGN=LEFT.
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=2>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


<TH...></TH> stands for table header. Header cells are identical to data cells in all respects, with exception that header cells are in bold FONT, and have default ALIGN=CENTER.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=2>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


<CAPTION...><CAPTION> represents caption for table. CAPTION tags should appear inside TABLE but not inside table rows or cells. CAPTION accepts alignment attribute that defaults to ALIGN=TOP but can be explicitly set to ALIGN=BOTTOM. Captions are always horizontally centered with respect to table, and may have their lines broken to fit within width of table.
Figure 4.12. Attendance at and State of the last two seminars.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=2>
<CAPTION>
Figure 4.12. Attenance at and State of the last two seminars.
</CAPTION>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


Figure 4.12. Attendance at and State of the last two seminars.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=2>
<CAPTION ALIGN=BOTTOM>
Figure 4.12. Attenance at and State of the last two seminars.
</CAPTION>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


BORDER attribute appears in TABLE tag. Borders are drawn around all table cells. Borders can be arbitrarily thick.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=10>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


COLSPAN attribute can appear in any table cell (TH or TD) and it specifies how many columns of table this cell should span. Default COLSPAN for any cell is 1.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country
wingkyNo Data Available

<TABLE BORDER=5>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
<TR>
<TD>wingky</TD>
<TD COLSPAN=2>No Data Available</TD>
</TR>
</TABLE>


ROWSPAN attribute can appear in any table cell (TH or TD) and it specifies how many rows of table this cell should span. Default ROWSPAN is 1.
NameAttendanceState
Hong Kong75S.A.Region
1254Country
420China

<TABLE BORDER=5>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD ROWSPAN=3>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
<TR>
<TD ALIGN=RIGHT>420</TD>
<TD ALIGN=CENTER>China</TD>
</TR>
</TABLE>


CELLSPACING=<value>

By default cell spacing of two. Cell spacing is amount of space inserted between individual cells in table.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=5 CELLSPACING=10>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


CELLPADDING=<value>

By default cell padding of one. Cell padding is amount of space between border of cell and contents of cell.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=5 CELLSPACING=10 CELLPADDING=15>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


Tables can be centered and WIDTH tag can be used to specify percentage of screen width to use for table.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<CENTER>
<TABLE BORDER=5 WIDTH=85%>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>
</CENTER>


Tables can use ALIGN=LEFT or ALIGN=RIGHT in which case they work just like images with text wrapping around them.
NameAttendanceState
Hong Kong75S.A.Region
China1254Country
This crucial Civil War campaign (April-July 1863) captured the last Confederate fortrerss on the Mississippi River. divided the Confederacy in two, and gave the Union complete control of the river.

<TABLE BORDER=5 ALIGN=LEFT>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>
This crucial Civil War campaign (April-July 1863) captured the last Confederate fortrerss on the Mississippi River. divided the Confederacy in two, and gave the Union complete control of the river.
<BR CLEAR=LEFT>


NameAttendanceState
Hong Kong75S.A.Region
China1254Country
This crucial Civil War campaign (April-July 1863) captured the last Confederate fortrerss on the Mississippi River. divided the Confederacy in two, and gave the Union complete control of the river.

<TABLE BORDER=5 ALIGN=RIGHT>
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD>China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>
This crucial Civil War campaign (April-July 1863) captured the last Confederate fortrerss on the Mississippi River. divided the Confederacy in two, and gave the Union complete control of the river.
<BR CLEAR=RIGHT>


Netscape 3.0 above and Internet Exolorer 3.0 above support table cell background colors

bgcolor attribute can be used with TABLE, TH,TR,TD tags

NameAttendanceState
Hong Kong75S.A.Region
China1254Country

<TABLE BORDER=5 BGCOLOR="YELLOW">
<TR>
<TH>Name</TH>
<TH>Attendance</TH>
<TH>State</TH>
</TR>
<TR>
<TD>Hong Kong</TD>
<TD ALIGN=RIGHT>75</TD>
<TD ALIGN=CENTER>S.A.Region</TD>
</TR>
<TR>
<TD BGCOLOR="PINK">China</TD>
<TD ALIGN=RIGHT>1254</TD>
<TD ALIGN=CENTER>Country</TD>
</TR>
</TABLE>


Can be used to enclose text in colored box.
Mississippi River Campaign
This crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river.

<CENTER>
<TABLE WIDTH=85%>
<TR>
<TD ALIGN=CENTER BGCOLOR="SILVER">
Mississippi River Campaign
</TD>
</TR>
<TR>
<TD BGCOLOR="YELLOW">
This crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river.
</TD>
</TR>
</TABLE>
</CENTER>


VALIGN tag controls whether text inside the table cell is aligned to TOP of cell, MIDDLE of cell (default), or BOTTOM of cell.
Mississippi River CampaignThis crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river. This victory, along with that at Gettysburg, Pennsylvania, (July 1-3, 1863) tilted the war in favor of the North.

<TABLE BORDER=5>
<TR>
<TD>Mississippi River Campaign</TD>
<TD>This crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river. This victory, along with that at Gettysburg, Pennsylvania, (July 1-3, 1863) tilted the war in favor of the North.</TD>
</TR>
</TABLE>


Mississippi River CampaignThis crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river. This victory, along with that at Gettysburg, Pennsylvania, (July 1-3, 1863) tilted the war in favor of the North.

<TABLE BORDER=5>
<TR>
<TD VALIGN=TOP>Mississippi River Campaign</TD>
<TD>This crucial Civil War campaign (April-July 1863) captured the last Confederate fortress on the Mississippi River, divided the Confederacy in two, and gave the Union complete control of the river. This victory, along with that at Gettysburg, Pennsylvania, (July 1-3, 1863) tilted the war in favor of the North.</TD>
</TR>
</TABLE>


Tables can contain hyperlinks, images, images that are hyperlinks, and different color fonts
Buster Dunsmore's Table of Interesting Things
Thank you for Visiting! advanced HTML Guide

<TABLE BORDER>
<TR>
<TD ALIGN=CENTER>
<IMG SRC="images/canlink.gif"></TD>
<TD><FONT SIZE=+2>
Buster Dunsmore's Table of Interesting Things
</FONT></TD>
<TD ALIGN=CENTER>
<IMG SRC="images/canlink.gif"></TD>
</TR>
<TR>
<TD><FONT COLOR="RED">
Thank you for Visiting!</FONT></TD>
<TD ALIGN=CENTER>
<A HREF="http://www.cs.turtor.edu/peolpe/sda">
<IMG SRC="images/global.gif"></A></TD>
<TD><A HREF="advhtmlguide.html">advanced HTML Guide</A></TD>
</TR>
</TABLE>

Many images look better if their background colour matches the browser's window colour.

The image will appear to float in the windows.

You could change the background colour of the images,

BUT ...some browsers set their own background colour.

The best Solution -- Create a .gif image with one color as "transparent"

This tells the browser to use the background color for those color pixels in the image

ppmtogif has "transparent" option

New Image --

tifftopnm < globe.tif | ppmtogif-trans #FF0000 > newglobe.gif

Existing Image --

giftopnm < globe.gif | ppmtogif =trans #FF0000 >

Image with Red Background

Image with Transparent Red Background

JPEG does not support transparent pixel because of the way it stores and uses pixel colours.

SERVER PUSH --

  • Server sends down page
  • Browser display page but leaves connection open
  • Whenever server wants, send another page and browser display it

CLIENT PULL --

  • Server sends down page including directive that says "reload page in 5 seconds" or "load another URL in 10 seconds"
  • Client does as told, either reloading current page or getting another one

    Dynamic Documents via Client Pull

    To Reload Page

    <META HTTP-EQUIV="Refresh" CONTENT=1>
    Document reloads itself once a second

    <META HTTP-EQUIV="Refresh" CONTENT=15>
    Dociment reloads itself every 15 seconds

    Make sure the META tag is used inside the HEAD of the HTML document

    The directive doesn't say "go get this page every 15 seconds from now until infinity"

    It says "go get this page in 15 seconds"

    If you set up an "infinite reload" situation, only way to interrupt is by pressing Back button or by going to different URL

    To Load Another URL

    <META HTTP-EQUIV="Refresh" CONTENT="8; URL=http://mentor.cc.home.edu/doc2.html">
    Loads doc2.html in 8 seconds

    Make sure the URL is fully-qualified

    Don't use a relative URL

    You can dynamically load several documents consecutively this way

    The last document should have no "Refresh" in it.

Many search engines rely heavily on the TITLE

Use keywords in the TITLE

<TITLE>International Programs (study abroad, student, scholars, campus seminars, faculty resource guide)</TITLE>Commas are ignored for keywords

Many search engines use the first 200-300 words for extracting a description and identifying keywords

Some search engines (for example, InfoSeek, Alta Vista) will let you specify these yourself using META tag attribute NAME

Remember: META tag must be in HEAD of HTML document

<META NAME="Description" CONTENT="The mission of the Office of International Programs at open source is to facilitate the development of educational opportunities, research and other services essential to open source ability to perform its land-grant university mission in the context of the global environment of the 21st century.">

<META NAME="Keywords" CONTENT="study abroad, student, scholars, campus seminars, faculty resource guide">

Some search engines (for example, Excite) pay attention to comments as well as regular text. Use a comment to specify keywords withouts destroying the readability of the page.

<!-- study abroads, student, scholars, campus seminars, faculty resource guide -->

A web browser screen can be divided into sections called frames.

Each frame contains its own unique URL, allowing users to scroll through multiple pages simultaneously

This makes it possible to display banners, ledges, and tables of contents all at once.

Queries executed in one frame can generate results in another frame

Reduces need to jump back and forth between screens

Frame can function as ledge, constant area of the screen, keeping important information out front while the user scrolls through pages.

FRAME DOCUMENT

Frame Document has basic structure much like normal HTML document, except BODY container replaced by FRAMESET container.

<HTML>

<HEAD>
</HEAD>

<FRAMESET>
</FRAMESET>

</HTML>

FRAME SYNTAX

<FRAMESET>

Has 2 attributes
ROWS and COLS

Frame document has no BODY

FRAMESET tag has matching /FRAMESET tag

Within FRAMESET can only have other nested FRAMESET tag, FRAME tags, or NOFRAMES tag

ROWS="list"

ROWS attribute takes commas-separated list of values

Best to use percentage values

<FRAMESET ROWS="10%,25%,65%">

If total is not 100%, all percentages will be scaled to match total of 100%

COLS="list"

COLS attribute takes comma-separated list of values

Best to use percentage values

<FRAMESET COLS="20%,80%">

If total is not 100%, all percentages will be scaled to match total of 100%

FRAMESET tag can be nested inside other FRAMESET tags

<FRAME>

Defines single frame in frameset

Some selected attributes --

SRC="url"

SRC attribute takes URL of document to be displayed in this frame

NAME="window_name"

NAME attribute assigns name to frame so it can be targeted by links in other documents ... usually from other frames in same document

NAME attribute is optional

Named frames can have window contents targeted with TARGET attribute

<BASE TARGET="window_name">

Used when all (or most) links in frame targeted to same window

TARGET attribute establishes default window_name

<A HREF="cows.html">Cattle</A> will open cows.html in default window

<A HREF="cows.html" TARGET="ledge">Cattle</A> will open cows.html in window named "ledge"

<A HREF="cows.html" TARGET="_self">Cattle</A> will open cows.html in same frame the link is in -- useful for occasionally overriding a BASE target

<A HREF="cows.html" TARGET="_top">Cattle</A> will open cows.html in non-framed full-screen window -- useful for breaking out of frame nesting

SCROLLING="yes|no|auto"

SCROLLING attribute describes if frame should have scrollbar or not

yes = scrollbars always visible for frame

no = scrollbars never visible

auto = browser decides whether scrollbars needed

SCROLLING attribute is optional

Defaults value is auto

NORESIZE

NORESIZE attribute is flag indicating frame is not resizable by user

By default all frames are resizable

<NOFRAMES>

NOFRAMES tag is for alternative content viewable by non-Frame-capable clients

By default, frames have BORDER=5

But, this can be changed with BORDER=n in outermost FRAMESET

BORDER=0 leads to frames with no borders at all

Need for scrollbars overrides BORDER=0

CGI stands for Common Gateway Interface

Allows HTTPserver to run programs that generate dynamic documents, rather than being restricted to delivering only static documents

To enable CGI on a Web server, Web Master designates directory as CGI-bin directory

"bin" comes from old convention that directory containing executable program has "bin" (for BINary code) in its name -- /bin/usr/local/www/bin

Often programs named with suffix .cgi (like search.cgi)

When client requests document from this directory, rather than sending program to client, Web server runs program and sends output from program to client

Should use CGI programming whenever you need to get input from user or whenever information you want to send is dynamic

Any programming language that is supported on server machine can be used for CGI programs

Popular language are Java, Perl (Practical Extraction and Report Language), TCL

(Tool Command Language), C, and C++

Imagemap program is usually part of cgi-bin directory

    1. Create an image
    2. Create an imagemap file
File maps regions in the image to URLs

Imagemap is collection of polygons, rectangles, and circles

Try to keep individual items in image spaced out far enough so user clearly knows what he or she is clicking on

Identifying pixel locations in images -- A way to identify pixel locations in an image used in a clickable image map

Every line in imagemap file:

method URL coord1 coord2 ... coordn

method is one of the following:

default
    -- default URL -- coordinates: none (if click is not in a polygon, rectangle, or circle)
circle
    -- coordinates: center edgepoint
poly
    -- coordinates: up to 100 vertices in any order
rect
    -- coordinates: upper-left lower-right

URL must be full (not relative) URL

Each method is evaluated in order placed in imagemap file

For overlapping areas (circle inside of a rectangle), place whichever one you want evaluated first before the other in the imagemap file

default http://www.cc.same.edu/homes/bxd/special.html

poly http://www.cc.same.edu/OIP/iss/isshome.html 395,184 658,188 592,325 538,337 466,320 357,253

rect http://www.cc.same.edu/UPS/Student/picc/ 237,59 343,184

Imagemap file can be named anything but usually uses suffix .map (like world.map)
    3. Reference your imagemap in an HTML file
<A HREF="cgi-bin/bxd/imagemap/bxd/world.map">
<IMG SRC="images/worldmap.gif" BORDER=2 ISMAP></A>


Bring up that page and notice that Netscape2.0 (and beyond) Web browsers tell you the x,y location of any point.

Limitations of server side image map implementation:

    1. Server transaction required to determine where link is directed
    2. No way for browser to show where portion of image map leads before user clicks on it
Client Side Image Map

USEMAP attribute of IMG element indicates client-side image map

Argument to USEMAP specifies which map to use with image

Format similar to HREF attribute on anchors

If argument to USEMAP starts with a "#", assumed to be in the same document as the IMG tag

<IMG SRC='images/map.gif" BORDER=2 USEMAP="#places">

Regions of image are described using MAP element

<MAP NAME="name">

<AREA [SHAPE="shape"] COORDS="x,y,..."[HREF="reference"]>

</MAP>

Name specifies name of map so can be referenced by IMG element

Shape gives shape of area

Currently supported shapes include rectangles (RECT), polygons (POLY), circles (CIRCLE), and default (DEFAULT)

RECT
    -- coordinates: upper-left lower-right
POLY
    -- coordinates: up to 100 vertices in any order
CIRCLE
    -- coordinates:center radius (NOTE! Differs from server-side image map which uses center and edgepoint)
DEFAULT usually unnecessary
    -- any region of image not defined by AREA tag assumed to do nothing

If DEFAULT is used to map to some other URL, put it last -- otherwise, nothing after it works (NOTE! Differs from server-side image map which uses DEFAULT in more sane manner)

COORDS tag gives coordinates of shape

HREF tag specifies where click in that area should lead

Unlike Server Side, HREF can be relative URL

<MAP NAME="places">

<AREA SHAPE="CIRCLE" COORDS="229,70,35" HREF="getfit.html">

<AREA SHAPE="RECT" COORDS="30,46,157,95" HREF="http://www.nbc.com/">

<AREA SHAPE="POLY" COORDS="145,134,220,189,77,188" HREF="http://www.nbc.com/">

<AREA SHAPE="RECT" COORDS="1,1,289,218" HREF="http://www.fox.com/">

</MAP>

HTML forms are used to get information from user before giving requested information.

HTML Form Elements

<FORM> directive indicates beginning of HTML form

Should be followed by </FORM>

Document may contain one or more HTML forms

Sub elements of the <FORM> directive:

ACTION="/program.php" -- URL of PHP program that will process output of form; or
ACTION="mailto:user@domain.com" if there is no PHP program available.

METHOD="GET/POST" -- Method by which PHP or ASP Program will get output from form

GET method places form output on URL in query string -- http://.../program.php?AZe+stmall

POST method places output in stdin input file of php or asp program



<INPUT> firective defines an input field

TYPE=TEXT -- Text field that accepts character data (default)


TYPE=PASSWORD -- TEXT field that accepts character data, but does not display it


TYPE=CHECKBOX -- Field that is either "on" or "off"

Tennis
Basketball
Shufflebord
Euchre

TYPE=RADIO -- Only one of group of radio button can be "on". others are automatically turned off

Freshman
Sophomore
Junior
Senior

TYPE=SUBMIT -- Sends the form to the URL defined in the ACTION option of the <FORM> directive


TYPE=RESET -- Browser resets form fields to default values



NAME="name" -- Variable name associated with value of input field

SIZE=size -- Length in characters of input field (TEXT and PASSWORD input fields only)

MAXLENGTH=max -- Maximum number of characters for input field (TEXT and PASSWORD input field only)

CHECKED -- Field should be selected or checked by default (CHECKBOX and RADIO input fields only)

VALUE=default input text displayed originally (TEXT and PASSWORD input fields only)

VALUE=value returned when field is checked or selected (CHECKBOX and RADIO input fields only)

VALUE=text displayed on button (SUBMIT and RESET input fields only) -- Defaults are "Submit Query" and "Reset"



<TEXTAREA> directive defines large text input field


Any text between <TEXTAREA> and </TEXTAREA> directive will be default text displayed originally

<TEXTAREA> Options:

NAME="name" -- Variable name associated with text in input area

ROWS=rows -- Rows of text in input area

COLS=cols -- Columns of text in input area



<SELECT> and <OPTION> directives




Must be used together

<OPTION> directive defines selection item

Multiple <OPTION> directives usually specified

Must be between <SELECT> and </SELECT> directives

Options to <SELECT> directive:

NAME="name" -- Variable name associated with returned selection

SIZE=num -- Number of options displayed at any one time

MULTIPLE -- More than one selection can be made

Options to <OPTION> directive:

SELECTED -- This option selected by default



INPUT TYPE=TEXT

What is your favorite city?
  

The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
What is your favorite city?
<INPUT TYPE=TEXT NAME=city SIZE=20 MAXLENGTH=40 VALUE=Hong Kong">
<INPUT TYPE=SUBMIT>
<INPUT TYPE=RESET>
</FORM>



INPUT TYPE=PASSWORD

Please enter your password:
  

The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
Please enter your password:
<INPUT TYPE=PASSWORD NAME=pass SIZE=12 MAXLENGTH=12>
<INPUT TYPE=SUBMIT VALUE=Submit>
<INPUT TYPE=RESET>
</FORM>



INPUT TYPE=CHECKBOX

Tennis
Basketball
Shuffleboard
Euchre
 
The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
<INPUT TYPE=CHECKBOX NAME=tennis VALUE="tennis"> Tennis
<INPUT TYPE=CHECKBOX NAME=bball VALUE="basketball"> Basketball
<INPUT TYPE=CHECKBOX NAME=shuff VALUE="shuffleboard"> Shuffleboard
<INPUT TYPE=CHECKBOX NAME=euchre VALUE="euchre" CHECKED> Euchre
<INPUT TYPE=SUBMIT VALUE=Submit>
<INPUT TYPE=RESET VALUE="Start Over">
</FORM>



INPUT TYPE=RADIO

Freshman
Sophomore
Junior
Senior
 
The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
Freshman <INPUT TYPE=RADIO NAME=year VALUE="your Freshman">
Sophomore <INPUT TYPE=RADIO NAME=year VALUE="your Sophomore" CHECKED>
Junior <INPUT TYPE=RADIO NAME=year VALUE="your Junior">
Senior <INPUT TYPE=RADIO NAME=year VALUE="your Senior" >
<INPUT TYPE=SUBMIT VALUE=Submit>
<INPUT TYPE=RESET VALUE="Reset">
</FORM>



TEXTAREA

What is your address?

 
The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
What is your address?

<TEXTAREA> NAME=address ROWS=5 COLS=30>

Type text area input, what it to do?
</TEXTAREA>
<INPUT TYPE=SUBMIT VALUE=Submit>
<INPUT TYPE=RESET VALUE="Restart">
</FORM>



SELECT and OPTION

 
The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
<SELECT NAME=univ SIZE=1>
<OPTION SELECTED> Hong Kong
<OPTION> China
<OPTION> Taiwan
<OPTION> Japen
<OPTION> Korea
</SELECT>
<INPUT TYPE=SUBMIT VALUE=Submit>
<INPUT TYPE=RESET>
</FORM>



 
The code for this form is:

<FORM METHOD=POST ACTION=/program.php>
<SELECT NAME=univ SIZE=3>
<OPTION SELECTED> Hong Kong
<OPTION> China
<OPTION> Taiwan
<OPTION> Japen
<OPTION> Korea
</SELECT>
<INPUT TYPE=SUBMIT VALUE=Submit>
<INPUT TYPE=RESET>
</FORM>












 
 Privacy Statement | Disclaimer | Copyrights © 2004, Wingck'C Web Technologies. All Rights Reserved open source of GNU