Introduction to Internet Resources and Services
Spring '99
#43405 (Tue)
#43400 (Thu)
Class Notes: HTML Authoring
The
icon marks items that are frequently overlooked, with unhappy consequences.
A companion page illustrates the tags
discussed here.
Hypertext Markup Language (HTML)
- HTML is a Document Type Definition (DTD) for the
Standardized General Markup Language (SGML).
- HTML describes document structure, not
document appearance.
![[CAUTION!]](graphics/small-caution.gif)
- A recipe for agony: forget about structure and just try to make
it look good on your browser.
- Correct HTML ensures your document continues to look great:
- with different browsers (Netscape, IE, Opera, etc.).
- under different conditions (window size, color depth, etc.).
- on unexpected platforms (Lynx, WebTV, Palm, car dashboard,
etc.).
- in the future (HTML 3.2, HTML 4, and beyond).
- HTML document are plain text files.
- We will use Windows Notepad or Mac Simple Text
to create documents.
- Save with .html or .htm filetype to
ensure system recognizes document as HTML.
![[CAUTION!]](graphics/small-caution.gif)
- The browser can view local files.
HTML Tags and Markup
HTML 3.2 Document Template
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>document title</TITLE>
</HEAD>
<BODY>
.
.
document body
.
.
</BODY>
</HTML>
- The HTML 3.2 DTD is required for all class assignments.
![[CAUTION!]](graphics/small-caution.gif)
- The <HEAD> is document meta-information.
- The <TITLE> generally appears in the browser
title bar.
- The <BODY> is the document content.
Paragraphs
- Example: <P>Hello world!</P>
- Paragraph is a container, but closing tag is implied.
- Accepts parameter: ALIGN=(left,right,center)
- <P><P><P> won't create space.
Even worse, you are falling into the "describing
document layout" trap.
Document Headings
Divisions
- Divides sections of the document:
<DIV> ... </DIV>
- Accepts parameter: ALIGN=(left,right,center)
- Gets more interesting with cascading style sheets (CSS).
- The <CENTER> tag is evil. It conveys
no information about document structure.
![[CAUTION!]](graphics/small-caution.gif)
Text Styles
- Logical Style - Describes what the text is, and browser formats
appropriately.
Emphasis |
hello world |
<EM>hello world</EM> |
Stronger Emphasis |
hello world |
<STRONG>hello world</STRONG> |
Computer Code |
hello world |
<CODE>hello world</CODE> |
(Sample) Computer Output |
hello world |
<SAMP>hello world</SAMP> |
Computer (Keyboard) Input |
hello world |
<KBD>hello world</KBD> |
Variable Name |
hello world |
<VAR>hello world</VAR> |
Text Citation |
hello world |
<CITE>hello world</CITE> |
- Physical Style - Specifies how the text should be displayed.
Italic |
hello world |
<I>hello world</I> |
Bold |
hello world |
<B>hello world</B> |
Monospace (typewriter text) |
hello world |
<TT>hello world</TT> |
- What does <I> mean on a display that doesn't
do italics? Or on a text-to-speech machine?
- There are many more. (superscript, strikeout, etc.)
- Be sure to nest containers properly.
wrong |
<B><I>zounds!</B></I> |
right |
<B><I>zounds!</I></B> |
Lists
- Ordered List: <OL>
<LI> ... </OL>
- Unordered List: <UL>
<LI> ... </UL>
- Dictionary List: <DL>
<DT> ...
<DD> ... </DL>
- Closing tag of list item container is safely implied.
Miscellaneous Markups
- Block Quote: <BLOCKQUOTE>
... </BLOCKQUOTE>
- Preformatted Text: <PRE>
... </PRE>
- Line Break: <BR>
- Horizontal Rule: <HR>
Anchors
- Anchors create hyperlinks:
<A HREF="location"> ... </A>
- The location almost always contains characters that must be quoted.
![[CAUTION!]](graphics/small-caution.gif)
- Location may be: complete URL, full pathname or relative pathname.
- Directories map to a default document, often index.html.
- The slash at the end of directory names is required.
![[CAUTION!]](graphics/small-caution.gif)
Images
Image and Anchor Locations
- The target URL of an <A> or <IMG>
is calculated with respect to the current base URL.
- The base URL typically is that of the current document.
- The base URL may be specified by including <BASE
HREF="location"> in <HEAD>.
- The anchor <A HREF="./"> is a clever trick to
link to the default document.
Base URL |
HREF="location" |
Target URL |
scheme://host/directory/file |
scheme://host/directory/file |
scheme://host/directory/file |
scheme://host/directory/file |
/full/pathname |
scheme://host/full/pathname |
scheme://host/directory/file |
relative/pathname |
scheme://host/directory/relative/pathname |
Body Parameters
Font Modifications
- Font parameters may be modified:
<FONT> ... </FONT>
- The <FONT> tag is just as evil
as <CENTER>, but there is
no (HTML 3.2) alternative.
- The user has configured their browser for maximum readability.
Your <FONT> changes will reduce readibility.
![[CAUTION!]](graphics/small-caution.gif)
- Modify size parameter: SIZE=value
- Size value may be absolute (SIZE=4) or
relative (SIZE="+1").
![[CAUTION!]](graphics/small-caution.gif)
- Modify color parameter: COLOR=color
- Modify typeface parameter: FACE="selection[,...]"
- FACE is a non-standard browser extension.
- Available typefaces are system dependent.
![[CAUTION!]](graphics/small-caution.gif)
- Example:
<FONT SIZE="+1"
COLOR=green
FACE="sans-serif,arial,helvetica,geneva">
- <FONT> is not a block element.
![[CAUTION!]](graphics/small-caution.gif)
-- WRONG -- -- RIGHT --
<FONT>
<P> ... <P> <FONT> ... </FONT>
<P> ... <P> <FONT> ... </FONT>
<P> ... <P> <FONT> ... </FONT>
</FONT>
- Style sheets (HTML 4.0) are a better solution.
Tables
- Basic elements:
- Table container:
<TABLE> ... </TABLE>
- Table caption container:
<CAPTION> ... </CAPTION>
- Row container:
<TR> ... </TR>
- Datum container:
<TD> ... </TD>
- Heading container:
<TH> ... </TH>
- TABLE parameters:
- cell border: BORDER=pixels
- internal cell padding: CELLPADDING=pixels
- external cell spacing: CELLSPACING=pixels
- table width: WIDTH=pixels_or_percent
- alignment: ALIGN=(left,center,right)
- background color: BGCOLOR=color
- TR parameters:
- horizontal alignment: ALIGN=(left,center,right)
- vertical alignment: VALIGN=(top,middle,bottom)
- TD and TH parameters:
- horizontal alignment: ALIGN=(left,center,right)
- vertical alignment: VALIGN=(top,middle,bottom)
- cell width: WIDTH=pixels
- cell height: HEIGHT=pixels
- column spanning: COLSPAN=n
- row spanning: ROWSPAN=n
- background color: BGCOLOR=color
BACK:
Class Notes |
LIS 341 |
GSLIS |
UT
Chip Rosenthal
<chipr@gslis.utexas.edu>
$Id: notes_html.html,v 4.4 1999/04/13 21:35:12 chip Exp $