Page 1
What is HTML?
__rendered_path__1
Answer1:
__rendered_path__4
HTML, or HyperText Markup Language, is a Universal language which allows an
__rendered_path__4
individual using special code to create web pages to be viewed on the Internet.
__rendered_path__8
__rendered_path__4
Answer2:
__rendered_path__4
HTML ( H yper T ext M arkup L anguage) is the language used to write Web pages. You
__rendered_path__8
are looking at a Web page right now.
__rendered_path__4
You can view HTML pages in two ways:
__rendered_path__4
* One view is their appearance on a Web browser, just like this page
--
colors, different
__rendered_path__4
text sizes, graphics.
__rendered_path__8
* The other view is called "HTML Code"
--
this is th
e code that tells the browser what to
__rendered_path__4
do.
__rendered_path__32
What is a tag?
__rendered_path__8
In HTML, a tag tells the browser what to do. When you write an HTML page, you enter
__rendered_path__8
tags for many reasons
--
to change the appearance of text, to show a graphic, or to
__rendered_path__4
make a link to another page.
__rendered_path__32
What is the simplest HTML page?
__rendered_path__8
HTML Code:
__rendered_path__8
<HTML>
__rendered_path__4
<HEAD>
__rendered_path__4
<TITLE>This is my page title! </ TITLE>
__rendered_path__4
</ HEAD>
__rendered_path__8
<BODY>
__rendered_path__4
This is my message to the world!
__rendered_path__4
</ BODY>
__rendered_path__8
</ HTML>
__rendered_path__4
__rendered_path__4
Browser Display:
__rendered_path__4
This is my message to the world!
__rendered_path__71
How do I create frames? What is a frameset?
__rendered_path__74
Frames allow an author to divide a browser window into multiple (rectangular) regions.
__rendered_path__4
Multiple documents can be displayed in a single window, each within its own frame.
__rendered_path__4
Graphical browsers allow these frames to be scrolled independently of each other, and
__rendered_path__8
links can update the document displayed in one frame without affecting the others.
__rendered_path__4
You can't just "add frames" to an existing document. Rather, you must create a
__rendered_path__4
frameset document that defines a particular combination of frames, and then display
__rendered_path__8
your content documents inside those frames. The frameset document should also
__rendered_path__4
include alternative non-framed content in a NOFRAMES element.
__rendered_path__4
The HTML 4 frames model has significant design flaws that cause usability problems
__rendered_path__4
for web users. Frames should be used only with great care.
__rendered_path__32
How can I include comments in HTML?
__rendered_path__74
Technically, since HTML is an SGML application, HTML uses SGML comment syntax.
__rendered_path__4
However, the full syntax is complex, and browsers don't support it in its entirety
__rendered_path__4
anyway. Therefore, use the following simplified rule to create HTML comments that
__rendered_path__8
both have valid syntax and work in browsers:
__rendered_path__4
__rendered_path__4
An HTML comment begins with "<!--", ends with "-->", and does not contain "--" or ">"
__rendered_path__4
anywhere in the comment.
__rendered_path__8
The following are examples of HTML comments:
__rendered_path__4
__rendered_path__4__rendered_path__8
* <!
--
T
his is a comment.
--
>

Page 2
* <!
--
This is another comment,
__rendered_path__1
and it continues onto a second line. -->
__rendered_path__7
* <!---->
__rendered_path__1
__rendered_path__1
Do not put comments inside tags (i.e., between "<" and ">") in HTML markup.
__rendered_path__17
What is a Hypertext link?
__rendered_path__20
A hypertext link is a special tag that links one page to another page or resource. If you
__rendered_path__1
click the link, the browser jumps to the link's destination.
__rendered_path__26
How comfortable are you with writing HTML entirely by hand?
__rendered_path__17
Very. I don’t usually use WYSIWYG. The only occasions when I do use Dreamweaver
__rendered_path__7
are when I want to draw something to see what it looks like, and then I’ll usually either
__rendered_path__1
take that design and hand-modify it or build it all over again from scratch in code. I
__rendered_path__1
have actually written my own desktop HTML IDE for Windows (it’s called Less Than
__rendered_path__7
Slash) with the intention of deploying it for use in web development training. If has
__rendered_path__1
built-in reference features, and will autocomplete code by parsing the DTD you specify
__rendered_path__1
in the file. That is to say, the program doesn’t know anything about HTML until after it
__rendered_path__7
parses the HTML DTD you specified. This should give you some idea of my skill level
__rendered_path__1
with HTML.
__rendered_path__26
What is everyone using to write HTML?
__rendered_path__20
Everyone has a different preference for which tool works best for them. Keep in mind
__rendered_path__1
that typically the less HTML the tool requires you to know, the worse the output of the
__rendered_path__7
HTML. In other words, you can always do it better by hand if you take the time to learn
__rendered_path__1
a little HTML.
__rendered_path__17
What is a DOCTYPE? Which one do I use?
__rendered_path__7
According to HTML standards, each HTML document begins with a DOCTYPE
__rendered_path__7
declaration that specifies which version of HTML the document uses. Originally, the
__rendered_path__1
DOCTYPE declaration was used only by SGML-based tools like HTML validators, which
__rendered_path__1
needed to determine which version of HTML a document used (or claimed to use).
__rendered_path__7
Today, many browsers use the document's DOCTYPE declaration to determine whether
__rendered_path__1
to use a stricter, more standards-oriented layout mode, or to use a "quirks" layout
__rendered_path__1
mode that attempts to emulate older, buggy browsers.
__rendered_path__17
Can I nest tables within tables?
__rendered_path__7
Yes, a table can be embedded inside a cell in another table. Here's a simple example:
__rendered_path__7
__rendered_path__1
<table>
__rendered_path__1
<tr>
__rendered_path__7
<td>this is the first cell of the outer table</ td>
__rendered_path__1
<td>this is the second cell of the outer table,
__rendered_path__1
__rendered_path__1
with the inner table embedded in it
__rendered_path__7
<table>
__rendered_path__1
<tr>
__rendered_path__1
<td>this is the first cell of the inner table</ td>
__rendered_path__7
<td>this is the second cell of the inner table</ td>
__rendered_path__1
</ tr>
__rendered_path__1
</ table>
__rendered_path__7
</ td>
__rendered_path__1
</ tr>
__rendered_path__1__rendered_path__1
</ table>

Page 3
__rendered_path__1
The main caveat about nested tables is that older versions of Netscape Navigator have
__rendered_path__3
problems with them if you don't explicitly close your TR, TD, and TH elements. To avoid
__rendered_path__1
problems, include every </ tr>, </ td>, and </ th> tag, even though the HTML
__rendered_path__1
specifications don't require them. Also, older versions of Netscape Navigator have
__rendered_path__1
problems with tables that are nested extremely deeply (e.g., tables nested ten deep). To
__rendered_path__3
avoid problems, avoid nesting tables more than a few deep. You may be able to use the
__rendered_path__1
ROWSPAN and COLSPAN attributes to minimize table nesting. Finally, be especially
__rendered_path__1
sure to validate your markup whenever you use nested tables.
__rendered_path__13
How do I align a table to the right (or left)?
__rendered_path__17
You can use <TABLE ALIGN="right"> to float a table to the right. (Use ALIGN="left" to
__rendered_path__1
float it to the left.) Any content that follows the closing </ TABLE> tag will flow around
__rendered_path__1
the table. Use <BR CLEAR="right"> or <BR CLEAR="all"> to mark the end of the text
__rendered_path__3
that is to flow around the table, as shown in this example:
__rendered_path__1
__rendered_path__1
The table in this example will float to the right.
__rendered_path__1
<table align="right">...</ table>
__rendered_path__3
This text will wrap to fill the available space to the left of (and if the text is long enough,
__rendered_path__1
below) the table.
__rendered_path__1
<br clear="right">
__rendered_path__3
This text will appear below the table, even if there is additional room to its left.
__rendered_path__37
How can I use tables to structure forms?
__rendered_path__40
Small forms are sometimes placed within a TD element within a table. This can be a
__rendered_path__1
useful for positioning a form relative to other content, but it doesn't help position the
__rendered_path__3
form-related elements relative to each other.
__rendered_path__1
To position form-related elements relative to each other, the entire table must be within
__rendered_path__1
the form. You cannot start a form in one TH or TD element and end in another. You
__rendered_path__1
cannot place the form within the table without placing it inside a TH or TD element.
__rendered_path__3
You can put the table inside the form, and then use the table to position the INPUT,
__rendered_path__1
TEXTAREA, SELECT, and other form-related elements, as shown in the following
__rendered_path__1
example.
__rendered_path__3
__rendered_path__1
<FORM ACTION="[URL]">
__rendered_path__1
<TABLE BORDER="0">
__rendered_path__1
<TR>
__rendered_path__3
<TH>Account:</ TH>
__rendered_path__1
<TD><INPUT TYPE="text" NAME="account"></ TD>
__rendered_path__1
</ TR>
__rendered_path__3
<TR>
__rendered_path__1
<TH>Password:</ TH>
__rendered_path__1
<TD><INPUT TYPE="password" NAME="password"></ TD>
__rendered_path__3
</ TR>
__rendered_path__1
<TR>
__rendered_path__1
<TD> </ TD>
__rendered_path__1
<TD><INPUT TYPE="submit" NAME="Log On"></ TD>
__rendered_path__3
</ TR>
__rendered_path__1
</ TABLE>
__rendered_path__1
</ FORM>
__rendered_path__13
How do I center a table?
__rendered_path__40
In your HTML, use
__rendered_path__1
__rendered_path__1
<div class="center">
__rendered_path__1__rendered_path__3
<table>...</ table>

Page 4
</ div>
__rendered_path__1
__rendered_path__4
In your CSS, use
__rendered_path__1
__rendered_path__1
div.center {
__rendered_path__1
text-align: center;
__rendered_path__4
}
__rendered_path__15
__rendered_path__4
div.
center table {
__rendered_path__1
margin-left: auto;
__rendered_path__1
margin-right: auto;
__rendered_path__4
text-align: left;
__rendered_path__1
}
__rendered_path__34
How do I use forms?
__rendered_path__37
The basic syntax for a form is: <FORM ACTION="[URL]">...</ FORM>
__rendered_path__1
When the form is submitted, the form data is sent to the URL specified in the ACTION
__rendered_path__1
attribute. This URL should refer to a server-side (e.g., CGI) program that will process
__rendered_path__1
the form data. The form itself should contain
__rendered_path__4
__rendered_path__1
* at least one submit button (i.e., an <INPUT TYPE="submit" ...> element),
__rendered_path__1
* form data elements (e.g., <INPUT>, <TEXTAREA>, and <SELECT>) as needed, and
__rendered_path__4
* additional markup (e.g., identifying data elements, presenting instructions) as needed.
__rendered_path__57
How can I check for errors?
__rendered_path__37
HTML validators check HTML documents against a formal definition of HTML syntax
__rendered_path__1
and then output a list of errors. Validation is important to give the best chance of
__rendered_path__1
correctness on unknown browsers (both existing browsers that you haven't seen and
__rendered_path__4
future browsers that haven't been written yet).
__rendered_path__1
HTML checkers (linters) are also useful. These programs check documents for specific
__rendered_path__1
problems, including some caused by invalid markup and others caused by common
__rendered_path__4
browser bugs. Checkers may pass some invalid documents, and they may fail some
__rendered_path__1
valid ones.
__rendered_path__1
All validators are functionally equivalent; while their reporting styles may vary, they will
__rendered_path__4
find the same errors given identical input. Different checkers are programmed to look
__rendered_path__1
for different problems, so their reports will vary significantly from each other. Also,
__rendered_path__1
some programs that are called validators (e.g. the "CSE HTML Validator") are really
__rendered_path__1
linters/ checkers. They are still useful, but they should not be confused with real HTML
__rendered_path__4
validators.
__rendered_path__1
When checking a site for errors for the first time, it is often useful to identify common
__rendered_path__1
problems that occur repeatedly in your markup. Fix these problems everywhere they
__rendered_path__4
occur (with an automated process if possible), and then go back to identify and fix the
__rendered_path__1
remaining problems.
__rendered_path__1
Link checkers follow all the links on a site and report which ones are no longer
__rendered_path__1
functioning. CSS checkers report problems with CSS style sheets.
__rendered_path__95
Do I have to memorize a bunch of tags?
__rendered_path__37
No. Most programs that help you write HTML code already know most tags, and create
__rendered_path__1
them when you press a button. But you should understand what a tag is, and how it
__rendered_path__1
works. That way you can correct errors in your page more easily.
__rendered_path__95
How do I make a form so it can be submitted by hitting ENTER?
__rendered_path__95
The short answer is that the form should just have one <INPUT TYPE=TEXT> and no
__rendered_path__1__rendered_path__4
TEXTAREA, though it can have other form elements like checkboxes and radio buttons.

Page 5
How do I set the focus to the first form field?
__rendered_path__1
You cannot do this with HTML. However, you can include a script after the form that
__rendered_path__5
sets the focus to the appropriate field, like this:
__rendered_path__5
__rendered_path__10
<form id="myform" name="myform" action=...>
__rendered_path__5
<input type="text" id="myinput" name="myinput" ...>
__rendered_path__5
</ form>
__rendered_path__5
__rendered_path__10
<script type="text/ javascript">
__rendered_path__5
document.myform.myinput.focus();
__rendered_path__5
</ script>
__rendered_path__10
__rendered_path__5
A similar approach uses <body onload=...> to set the focus, but some browsers seem to
__rendered_path__5
process the ONLOAD event before the entire document (i.e., the part with the form) has
__rendered_path__5
been loaded.
__rendered_path__31
How can I eliminate the extra space after a </form> tag?
__rendered_path__1
HTML has no mechanism to control this. However, with CSS, you can set the margin-
__rendered_path__5
bottom of the form to 0. For example:
__rendered_path__5
<form style="margin-bottom:0;" action=...>
__rendered_path__10
__rendered_path__5
You can also use a CSS style sheet to affect all the forms on a page:
__rendered_path__5
form { margin
-
bottom: 0 ; }
__rendered_path__31
How can I use tables to structure forms?
__rendered_path__54
Small forms are sometimes placed within a TD element within a table. This can be a
__rendered_path__5
useful for positioning a form relative to other content, but it doesn't help position the
__rendered_path__5
form-related elements relative to each other.
__rendered_path__10
To position form-related elements relative to each other, the entire table must be within
__rendered_path__5
the form. You cannot start a form in one TH or TD element and end in another. You
__rendered_path__5
cannot place the form within the table without placing it inside a TH or TD element.
__rendered_path__5
You can put the table inside the form, and then use the table to position the INPUT,
__rendered_path__10
TEXTAREA, SELECT, and other form-related elements, as shown in the following
__rendered_path__5
example.
__rendered_path__5
<form action="[URL]">
__rendered_path__10
<table border="0">
__rendered_path__5
<tr>
__rendered_path__5
<th scope="row">
__rendered_path__87
<label for="account">Account:</ label>
__rendered_path__5
</ th>
__rendered_path__5
<td>
__rendered_path__10
<input type="text" name="account" id="account">
__rendered_path__5
</ td>
__rendered_path__5
</ tr>
__rendered_path__10
<tr>
__rendered_path__5
<th scope="row">
__rendered_path__105
<label for="password">Password:
__rendered_path__10
</ th>
__rendered_path__5
<td>
__rendered_path__5
<input type="password" name="password" id="password">
__rendered_path__10
</ td>
__rendered_path__5
</ tr>
__rendered_path__5
<tr>
__rendered_path__10
<td> </ td>
__rendered_path__5__rendered_path__5
<td><input type="submit" name="Log On"></ td>

Page 6
</ tr>
__rendered_path__1
</ table>
__rendered_path__4
</ form>
__rendered_path__1
How can I have two sets of links with different colors?
__rendered_path__9
You can suggest this presentation in a style sheet. First, specify colors for normal links,
__rendered_path__13
like this:
__rendered_path__17
a:link {color: blue; background: white}
__rendered_path__21
a:visited {color: purple; background: white}
__rendered_path__24
a:active {color: red; background: white}
__rendered_path__27
Next, identify the links that you want to have different colors. You can use the CLASS
__rendered_path__31
attribute in your HTML, like this:
__rendered_path__34
<a class="example1" href="[URL]">[link text]</ a>
__rendered_path__38
Then, in your style sheet, use a selector for links with this CLASS attribute, like this:
__rendered_path__42
a.example1:link {color: yellow; backg
round: black}
__rendered_path__46
a.example1:visited {color: white; background: black}
__rendered_path__50
a.example1:active {color: red; background: black}
__rendered_path__53
Alternatively, you can identify an element that contains the links that you want to have
__rendered_path__57
different colors, like this:
__rendered_path__59
<div class="example2">...
__rendered_path__63
<a href="[URL]">[link text]</ a>...
__rendered_path__67
<a href="[URL]">[link text]</ a>...
__rendered_path__67
<a href="[URL]">[link text]</ a>...
__rendered_path__67
</ div>
__rendered_path__74
Then, in your style sheet, use a selector for links in this containing element, like this:
__rendered_path__78
.example2 a:link {color: yellow; background:
black}
__rendered_path__82
.example2 a:visited {color: white; background: black}
__rendered_path__87
.example2 a:active {color: red; background: black}
__rendered_path__90
How can I show HTML examples without them being interpreted as part of my
__rendered_path__95
document?
__rendered_path__97
Within the HTML example, first replace the "&" character with "&amp;" everywhere it
__rendered_path__1
occurs. Then replace the "&lt;" character with "<" and the "&gt;" character with ">" in
__rendered_path__4
the same way.
__rendered_path__1
Note that it may be appropriate to use the CODE and/ or PRE elements when displaying
__rendered_path__1
HTML examples.
__rendered_path__107
How do I get special characters in my HTML?
__rendered_path__110__rendered_path__1
The special case of the less-than ('<'), greater-than ('>'), and ampersand ('&') characters.

Page 7
In general, the safest way to write HTML is in US-ASCII (ANSI X3.4, a 7-bit code),
__rendered_path__1
expressing characters from the upper half of the 8-bit code by using HTML entities.
__rendered_path__7
Working with 8-bit characters can also be successful in many practical situations: Unix
__rendered_path__1
and MS-Windows (using Latin-1), and also Macs (with some reservations).
__rendered_path__1
Latin-1 (ISO-8859-1) is intended for English, French, German, Spanish, Portuguese,
__rendered_path__1
and various other western European languages. (It is inadequate for many languages of
__rendered_path__7
central and eastern Europe and elsewhere, let alone for languages not written in the
__rendered_path__1
Roman alphabet.) On the Web, these are the only characters reliably supported. In
__rendered_path__1
particular, characters 128 through 159 as used in MS-Windows are not part of the
__rendered_path__7
ISO-8859-1 code set and will not be displayed as Windows users expect. These
__rendered_path__1
characters include the em dash, en dash, curly quotes, bullet, and trademark symbol;
__rendered_path__1
neither the actual character (the single byte) nor its nnn; decimal equivalent is
__rendered_path__46
correct in HTML. Also, ISO-8859-1 does not include the Euro currency character. (See
__rendered_path__7
the last paragraph of this answer for more about such characters.)
__rendered_path__1
On platforms whose own character code isn't ISO-8859-1, such as MS-DOS and Mac
__rendered_path__1
OS, there may be problems: you have to use text transfer methods that convert
__rendered_path__7
between the platform's own code and ISO-8859-1 (e.g., Fetch for the Mac), or convert
__rendered_path__1
separately (e.g., GNU recode). Using 7-bit ASCII with entities avoids those problems,
__rendered_path__1
but this FAQ is too small to cover other possibilities in detail.
__rendered_path__1
If you run a web server (httpd) on a platform whose own character code isn't ISO-8859-
__rendered_path__7
1, such as a Mac or an IBM mainframe, then it's the job of the server to convert text
__rendered_path__1
documents into ISO-8859-1 code when sending them to the network.
__rendered_path__1
If you want to use characters not in ISO-8859-1, you must use HTML 4 or XHTML
__rendered_path__7
rather than HTML 3.2, choose an appropriate alternative character set (and for certain
__rendered_path__1
character sets, choose the encoding system too), and use one method or other of
__rendered_path__1
specifying this.
__rendered_path__100
Should I put quotes around attribute values?
__rendered_path__103
It is never wrong to quote attribute values, and many people recommend quoting all
__rendered_path__1
attribute values even when the quotation marks are technically optional. XHTML 1.0
__rendered_path__1
requires all attribute values to be quoted. Like previous HTML specifications, HTML 4
__rendered_path__1
allows attribute values to remain unquoted in many circumstances (e.g., when the
__rendered_path__7
value contains only letters and digits).
__rendered_path__1
Be careful when your attribute value includes double quotes, for instance when you
__rendered_path__1
want ALT text like "the "King of Comedy" takes a bow" for an image. Humans can parse
__rendered_path__7
that to know where the quoted material ends, but browsers can't. You have to code the
__rendered_path__1
attribute value specially so that the first interior quote doesn't terminate the value
__rendered_path__1
prematurely. There are two main techniques:
__rendered_path__1
__rendered_path__7
* Escape any quotes inside the value with &#34; so you don't terminate the value
__rendered_path__1
prematurely: ALT="the &#34;King of Comedy&#34; takes a bow".
__rendered_path__1
* Use single quotes to enclose the attribute value: ALT='the "King of Comedy" takes a
__rendered_path__7
bow'.
__rendered_path__1
__rendered_path__1
Both these methods are correct according to the specification and are supported by
__rendered_path__1
current browsers, but both were poorly supported in some earlier browsers. The only
__rendered_path__7
truly safe advice is to rewrite the text so that the attribute value need not contain
__rendered_path__1
quotes, or to change the interior double quotes to single quotes, like this: ALT="the
__rendered_path__1
'King of Comedy' takes a bow".
__rendered_path__100
Posting Copy and Paste HTML
__rendered_path__103
For those wanting to post direct Copy and Paste HTML on screen without the use of
__rendered_path__1
spaces or *s etc. and the need to explain those substitutions: Use &lt; to substitute for
__rendered_path__1
each opening tag < in each tagged set of HTML. Example, typing the following: &lt;a
__rendered_path__7
href="http:/ / www.yourname.com">&lt;img
__rendered_path__1__rendered_path__1
src="http:/ / pics.yourname.com/ aw/ pics/ mask.gif">&lt;/ a> Will show up on screen as:

Page 8
<a href="http:/ / www.yourname.com"><img
__rendered_path__1
src="http:/ / pics.yourname.com/ aw/ pics/ mask.gif"></ a>
__rendered_path__3
HTML for Lists
__rendered_path__6
1. Bulleted Lists: <ul> begins a bulleted, indented list. Each item in the list is then
__rendered_path__1
prefaced with the <li> tag. It is not necessary to insert a break at the end of each line
--
__rendered_path__1
the <li> tag automatically creates a new line.
__rendered_path__15
__rendered_path__1
* with <li type=disc>
__rendered_path__1
* with <li type=square>
__rendered_path__1
* with <li type=circle>
__rendered_path__15
__rendered_path__1
2. Numbered Lists: <ol> begins a numbered, indented list. Each item in the list is then
__rendered_path__1
prefaced with the <li> tag. You need to close the list with the </ ol> tag. Note: You can
__rendered_path__15
expand the <ol> to specify the TYPE of numbering:
__rendered_path__1
__rendered_path__1
<ol> 1 (decimal numbers: 1, 2, 3, 4, 5, ...)
__rendered_path__1
<ol type="a"> a (lowercase alphabetic: a, b, c, d, e, ...)
__rendered_path__15
<ol type="A"> A (uppercase alphabetic: A, B, C, D, E, ...)
__rendered_path__1
<ol type="i"> i (lowercase Roman numerals: i, ii, iii, iv, v, ...)
__rendered_path__40
<ol type="I"> I (uppercase Roman numerals: I, II, III, IV, V, ...)
__rendered_path__44
Are there any problems with using tables for layout?
__rendered_path__15
On current browsers, the entire table must be downloaded and the dimensions of
__rendered_path__15
everything in the table must to be known before the table can be rendered. That can
__rendered_path__1
delay the rendering of your content, especially if your table contains images without
__rendered_path__1
HEIGHT or WIDTH attributes.
__rendered_path__1
If any of your table's content is too wide for the available display area, then the table
__rendered_path__15
stretches to accomodate the oversized content. The rest of the content then adjusts to
__rendered_path__1
fit the oversized table rather than fitting the available display area. This can force your
__rendered_path__1
readers to scroll horizontally to read your content, or can cause printed versions to be
__rendered_path__15
cropped.
__rendered_path__1
For readers whose displays are narrower than the author anticipated, fixed-width
__rendered_path__1
tables cause the same problems as other oversized tables. For readers whose displays
__rendered_path__15
are wider than the author anticipated, fixed-width tables cause extremely wide
__rendered_path__1
margins, wasting much of the display area. For readers who need larger fonts, fixed-
__rendered_path__1
width tables can cause the content to be displayed in short choppy lines of only a few
__rendered_path__1
words each.
__rendered_path__15
Many browsers are especially sensitive to invalid syntax when tables are involved.
__rendered_path__1
Correct syntax is especially critical. Even with correct syntax, nested tables may not
__rendered_path__1
display correctly in older versions of Netscape Navigator.
__rendered_path__15
Some browsers ignore tables, or can be configured to ignore tables. These browsers will
__rendered_path__1
ignore any layout you've created with tables. Also, search engines ignore tables. Some
__rendered_path__1
search engines use the text at the beginning of a document to summarize it when it
__rendered_path__1
appears in search results, and some index only the first n bytes of a document. When
__rendered_path__15
tables are used for layout, the beginning of a document often contains many navigation
__rendered_path__1
links that appear before than actual content.
__rendered_path__1
Many versions of Navigator have problems linking to named anchors when they are
__rendered_path__15
inside a table that uses the ALIGN attribute. These browsers seem to associate the
__rendered_path__1
named anchor with the top of the table, rather than with the content of the anchor. You
__rendered_path__1
can avoid this problem by not using the ALIGN attribute on your tables.
__rendered_path__1
If you use tables for layout, you can still minimize the related problems with careful
__rendered_path__15
markup. Avoid placing wide images, PRE elements with long lines, long URLs, or other
__rendered_path__1
wide content inside tables. Rather than a single full-page layout table, use several
__rendered_path__1__rendered_path__15
independent tables. For example, you could use a table to lay out a navigation bar at

Page 9
the top/ bottom of the page, and leave the main content completely outside any layout
__rendered_path__1
tables.
__rendered_path__5
How do I eliminate the blue border around linked images?
__rendered_path__8
In your HTML, you can specify the BORDER attribute for the image:
__rendered_path__1
<a href=...><img src=... alt=... border="0"></ a>
__rendered_path__1
However, note that removing the border that indicates an image is a link makes it
__rendered_path__18
harder for users to distinguish quickly and easily which images on a web page are
__rendered_path__1
clickable.
__rendered_path__5
How do I eliminate the space around/between my images?
__rendered_path__8
If your images are inside a table, be sure to set the BORDER, CELLSPACING, and
__rendered_path__1
CELLPADDING attributes to 0.
__rendered_path__18
Extra space between images is often created by whitespace around the <IMG> tag in
__rendered_path__1
the markup. It is safe to use newlines inside a tag (between attributes), but not between
__rendered_path__1
two tags. For example, replace this:
__rendered_path__18
__rendered_path__1
<td ...>
__rendered_path__1
<img src=... alt=...>
__rendered_path__1
<img src=... alt=...>
__rendered_path__18
</ td>
__rendered_path__1
__rendered_path__1
with this:
__rendered_path__18
__rendered_path__1
<td ...><img src=... alt=...><img src=... alt=...></ td>
__rendered_path__1
__rendered_path__1
According to the latest specifications, the two should be equivalent. However, common
__rendered_path__18
browsers do not comply with the specifications in this situation.
__rendered_path__1
Finally, extra space between images can appear in documents that trigger the
__rendered_path__1
"standards" rendering mode of Gecko-based browsers like Mozilla and Firefox.
__rendered_path__18
How can I specify colors?
__rendered_path__65
If you want others to view your web page with specific colors, the most appropriate way
__rendered_path__18
is to suggest the colors with a style sheet. Cascading Style Sheets use the color and
__rendered_path__1
background-color properties to specify text and background colors. To avoid conflicts
__rendered_path__1
between the reader's default colors and those suggested by the author, these two
__rendered_path__18
properties should always be used together.
__rendered_path__1
With HTML, you can suggest colors with the TEXT, LINK, VLINK (visited link), ALINK
__rendered_path__1
(active link), and BGCOLOR (background color) attributes of the BODY element.
__rendered_path__1
Note that these attributes are deprecated by HTML 4. Also, if one of these attributes is
__rendered_path__18
used, then all of them should be used to ensure that the reader's default colors do not
__rendered_path__1
interfere with those suggested by the author. Here is an example:
__rendered_path__1
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
__rendered_path__18
alink="#000080">
__rendered_path__1
Authors should not rely on the specified colors since browsers allow their users to
__rendered_path__1
override document-specified colors.
__rendered_path__95
How do I get form data emailed to me?
__rendered_path__8
The only reliable mechanism for processing form submissions is with a server-side
__rendered_path__1
(e.g., CGI) program. To send form data to yourself via email, you should use a server-
__rendered_path__1
side program that processes the form submission and sends the data to your email
__rendered_path__1
address.
__rendered_path__18__rendered_path__1
Some web service providers make standard form-to-email programs available to their

Page 10
customers. Check with your service provider for details.
__rendered_path__1
If you can install CGI programs on your own server, see the answer to the previous
__rendered_path__5
question for a list of useful resources.
__rendered_path__1
If you can't run CGI programs on your own server, you can use a remotely hosted form-
__rendered_path__1
to-email services. Note that the provider of a remotely hosted service will have access to
__rendered_path__1
any data submitted via the service.
__rendered_path__5
Forms that use action="mailto:..." are unreliable. According to the HTML specifications,
__rendered_path__1
form behavior is explicitly undefined for mailto URIs (or anything else other than HTTP
__rendered_path__1
URIs). They may work one way with one software configuration, may work other ways
__rendered_path__5
in other software configurations, and may fail completely in other software
__rendered_path__1
configurations.
__rendered_path__25
Can I prevent a form from being submitted again?
__rendered_path__5
No. The server-side (e.g., CGI) program that processes the form submission must
__rendered_path__5
handle duplicate submissions gracefully.
__rendered_path__1
You could generate the form with a server-side (e.g., CGI) program that adds a hidden
__rendered_path__1
field with a unique session ID. Then the server-side program that processes the form
__rendered_path__1
submission can check the session ID against a list of previously used session IDs. If the
__rendered_path__5
session ID has already been used, then an appropriate action can be taken (e.g., reject
__rendered_path__1
the submission, or update the previously submitted data).
__rendered_path__1
Ultimately, your server-side program must be smart enough to handle resubmitted
__rendered_path__5
data. But you can avoid getting resubmitted data by not expiring the confirmation page
__rendered_path__1
from form submissions. Since you want to expire pages quickly when they have
__rendered_path__1
transient data, you might want to avoid putting transient data on the confirmation
__rendered_path__1
page. You could provide a link to a database query that returns transient data though.
__rendered_path__25
How can I allow file uploads to my web site?
__rendered_path__60
These things are necessary for Web-based uploads:
__rendered_path__1
__rendered_path__1
* An HTTP server that accepts uploads.
__rendered_path__5
* Access to the / cgi-bin/ to put the receiving script. Prewritten CGI file-upload scripts
__rendered_path__1
are available.
__rendered_path__1
* A form implemented something like this:
__rendered_path__5
__rendered_path__1
<form method="post" enctype="multipart/ form-data" action="fup.cgi">
__rendered_path__1
File to upload: <input type=file name=upfile><br>
__rendered_path__1
Notes about the file: <input type=text name=note><br>
__rendered_path__5
<input type=submit value=Press> to upload the file!
__rendered_path__1
</ form>
__rendered_path__1
__rendered_path__5
Not all browsers support form-based file upload, so try to give alternatives where
__rendered_path__1
possible.
__rendered_path__1
__rendered_path__1
The Perl CGI.pm module supports file upload. The most recent versions of the cgi-lib.pl
__rendered_path__5
library also support file upload. Also, if you need to do file upload in conjunction with
__rendered_path__1
form-to-email, the Perl package MIME::Lite handles email attachments.
__rendered_path__107
How can I require that fields be filled in, or filled in correctly?
__rendered_path__5
Have the server-side (e.g., CGI) program that processes the form submission send an
__rendered_path__5
error message if the field is not filled in properly. Ideally, this error message should
__rendered_path__1
include a copy of the original form with the original (incomplete or incorrect) data filled
__rendered_path__1
in as the default values for the form fields. The Perl CGI.pm module provides helpful
__rendered_path__5
mechanisms for returning partially completed forms to the user.
__rendered_path__1
In addition, you could use JavaScript in the form's ONSUBMIT attribute to check the
__rendered_path__1
form data. If JavaScript support is enabled, then the ONSUBMIT event handler can
__rendered_path__1__rendered_path__5
inform the user of the problem and return false to prevent the form from being

Page 11
submitted.
__rendered_path__1
Note that the server-side program should not rely upon the checking done by the
__rendered_path__5
client-side script.
__rendered_path__9
How do I change the title of a framed document?
__rendered_path__14
The title displayed is the title of the frameset document rather than the titles of any of
__rendered_path__1
the pages within frames. To change the title displayed, link to a new frameset
__rendered_path__5
document using html_viva questions="_top" (replacing the entire frameset).
__rendered_path__9
How do I link an image to something?
__rendered_path__14
Just use the image as the link content, like this:
__rendered_path__1
__rendered_path__1
<a href=...><img src=... alt=...></ a>
__rendered_path__30
Should I end my URLs with a slash?
__rendered_path__14
The URL structure defines a hierarchy similar to a filesystem's hierarchy of
__rendered_path__1
subdirectories or folders. The segments of a URL are separated by slash characters
__rendered_path__1
("/ "). When navigating the URL hierarchy, the final segment of the URL (i.e., everything
__rendered_path__5
after the final slash) is similar to a file in a filesystem. The other segments of the URL
__rendered_path__1
are similar to the subdirectories and folders in a filesystem.
__rendered_path__1
When resolving relative URLs (see the answer to the previous question), the browser's
__rendered_path__5
first step is to strip everything after the last slash in the URL of the current document.
__rendered_path__1
If the current document's URL ends with a slash, then the final segment (the "file") of
__rendered_path__1
the URL is null. If you remove the final slash, then the final segment of the URL is no
__rendered_path__1
longer null; it is whatever follows the final remaining slash in the URL. Removing the
__rendered_path__5
slash changes the URL; the modified URL refers to a different document and relative
__rendered_path__1
URLs will resolve differently.
__rendered_path__1
For example, the final segment of the URL http:/ / www.mysite.com/ faq/ html/ is
__rendered_path__5
empty; there is nothing after the final slash. In this document, the relative URL all.html
__rendered_path__1
resolves to http:/ / www.mysite.com/ faq/ html/ all.html (an existing document). If the
__rendered_path__1
final slash is omitted, then the final segment of the modified URL
__rendered_path__1
http:/ / www.mysite.com/ faq/ html is "html". In this (nonexistent) document, the relative
__rendered_path__5
URL all.html would resolve to http:/ / www.mysite.com/ faq/ all.html (another
__rendered_path__1
nonexistent document).
__rendered_path__1
When they receive a request that is missing its final slash, web servers cannot ignore
__rendered_path__5
the missing slash and just send the document anyway. Doing so would break any
__rendered_path__1
relative URLs in the document. Normally, servers are configured to send a redirection
__rendered_path__1
message when they receive such a request. In response to the redirection message, the
__rendered_path__1
browser requests the correct URL, and then the server sends the requested document.
__rendered_path__5
(By the way, the browser does not and cannot correct the URL on its own; only the
__rendered_path__1
server can determine whether the URL is missing its final slash.)
__rendered_path__1
This error-correction process means that URLs without their final slash will still work.
__rendered_path__5
However, this process wastes time and network resources. If you include the final slash
__rendered_path__1
when it is appropriate, then browsers won't need to send a second request to the
__rendered_path__1
server.
__rendered_path__1
The exception is when you refer to a URL with just a hostname (e.g.,
__rendered_path__5
http:/ / www.mysite.com). In this case, the browser will assume that you want the main
__rendered_path__1
index ("/ ") from the server, and you do not have to include the final slash. However,
__rendered_path__1
many regard it as good style to include it anyway.
__rendered_path__30
__rendered_path__30
How do I create a button which acts like a link?
__rendered_path__5
This is best done with a small form:
__rendered_path__5
__rendered_path__1__rendered_path__1
<FORM ACTION="[URL]" METHOD=GET>

Page 12
<INPUT TYPE=submit VALUE="Text on button">
__rendered_path__1
</ FORM>
__rendered_path__4
__rendered_path__1
If you want to line up buttons next to each other, you will have to put them in a one-
__rendered_path__1
row table, with each button in a separate cell.
__rendered_path__1
Note that search engines might not find the html_viva questions document unless there is a normal
__rendered_path__4
link somewhere else on the page.
__rendered_path__1
A go-to-other-page button can also be coded in JavaScript, but the above is standard
__rendered_path__1
HTML and works for more readers.
__rendered_path__25
How can I make a form with custom buttons?
__rendered_path__28
Rather than a normal submit button (<input type="submit" ...>), you can use the image
__rendered_path__1
input type (<input type="image" ...>). The image input type specifies a graphical submit
__rendered_path__1
button that functions like a server-side image map.
__rendered_path__4
Unlike normal submit buttons (which return a name=value pair), the image input type
__rendered_path__1
returns the x-y coordinates of the location where the user clicked on the image. The
__rendered_path__1
browser returns the x-y coordinates as name.x=000 and name.y=000 pairs.
__rendered_path__1
For compatability with various non-graphical browsing environments, the VALUE and
__rendered_path__4
ALT attributes should be set to the same value as the NAME attribute. For example:
__rendered_path__1
<input type="image" name="Send" alt="Send" value="Send" src="send-button.gif">
__rendered_path__1
For the reset button, one could use <button type="reset" ...>, JavaScript, and/ or style
__rendered_path__4
sheets, although none of these mechanisms work universally.
__rendered_path__64
How do I specify page breaks in HTML?
__rendered_path__28
There is no way in standard HTML to specify where page breaks will occur when
__rendered_path__1
printing a page. HTML was designed to be a device-independent structural definition
__rendered_path__1
language, and page breaks depend on things like the fonts and paper size that the
__rendered_path__4
person viewing the page is using.
__rendered_path__64
How do I remove the border around frames?
__rendered_path__28
Removing the border around frames involves both not drawing the frame borders and
__rendered_path__1
eliminating the space between the frames. The most widely supported way to display
__rendered_path__4
borderless frames is <FRAMESET ... BORDER=0 FRAMEBORDER=0
__rendered_path__1
FRAMESPACING=0>.
__rendered_path__1
Note that these attributes are proprietary and not part of the HTML 4.01 specifications.
__rendered_path__4
(HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not
__rendered_path__1
for the FRAMESET element.) Also, removing the border around a frame makes it
__rendered_path__1
difficult to resize it, as this border is also used in most GUIs to change the size of the
__rendered_path__1
frame.
__rendered_path__25
What is the difference between the HTML form methods GET and POST?
__rendered_path__95
The method parameter specifies which method the client is using to send information
__rendered_path__1
to the WEB server. The method determines which parameter you will find the CGI
__rendered_path__1
request data in:
__rendered_path__4
__rendered_path__1
* POST
-
post_args
__rendered_path__1
* GET
-
httpargs
__rendered_path__64
How do I rename all the files from .htm to .html after copying them from a PC
__rendered_path__28
to a UNIX machine?
__rendered_path__4
UNIX's mv (`move') command won't handle wildcard filenames. However, there's a
__rendered_path__4
program called htmaddl (for `HTM-add-"L"'), so you can login and type htmaddl. This
__rendered_path__1
will rename all .htm files to .html
__rendered_path__1
__rendered_path__4__rendered_path__1
If you haven't got this program on your UNIX machine, you can type it into a file called

Page 13
htmaddl:
__rendered_path__1
__rendered_path__4
#! / bin/ sh
__rendered_path__1
__rendered_path__1
for f in *.htm; do
__rendered_path__1
base=`basename $f .htm`
__rendered_path__4
mv $f $base.html
__rendered_path__1
done
__rendered_path__1
__rendered_path__4
After saving it and exiting your editor, make it executable by typing the command
__rendered_path__1
chmod ugo+x htmaddl
__rendered_path__1
Best of all, move it into your ~/ bin directory, or ask your WebMeister to put it in
__rendered_path__1
/ usr/ local/ bin so everyone can use it.
__rendered_path__24
How do I put sounds for older versions of Internet Explorer?
__rendered_path__27
For older versions of Internet Explorer, this technique was used <BG
__rendered_path__1
SOUND="sound.ext">.
__rendered_path__33
Can I use any HTML in the box?
__rendered_path__4
Yes. Any HTML tag that your browser supports will work in the box. So you can carry
__rendered_path__4
tags from chapters to chapters and mix and match...
__rendered_path__33
How to transferring user to new web page automatically?
__rendered_path__27
You will need to use the below meta tag.
__rendered_path__1
<META HTTP-EQUIV="Refresh" CONTENT="2"; URL="http:/ / www.yourname.com">
__rendered_path__4
Placing the above tag in your <HEAD></ HEAD> will load yousite.com in 2 seconds.
__rendered_path__1
Changing the 2 value on CONTENT="2" to another value will increase or decrease the
__rendered_path__1
delay until loading the new page.
__rendered_path__24
I'm trying to `include' a HTML document in another document...Is there a way
__rendered_path__27
to do this?
__rendered_path__4
Yes, there are several ways to do this. But remember, HTML is not a programming
__rendered_path__4
language
-
it doesn't have `directives': it's a markup language, so trying to compare it to
__rendered_path__1
C or Pascal is not going to be very meaningful.
__rendered_path__1
__rendered_path__1
SGML already provides the standard way to do this, using an entry in the DocType
__rendered_path__4
Declaration for a file:
__rendered_path__1
__rendered_path__1
<!doctype html public "
-
/ / IETF/ / DTD HTML 3.0/ / EN" [
__rendered_path__4
<!entity foo system "bar.html">
__rendered_path__1
]>
__rendered_path__1
...
__rendered_path__4
and then later when you want to include the file
__rendered_path__1
...
__rendered_path__1
&foo;
__rendered_path__1
__rendered_path__4
This is the General Entity mechanism used universally in normal SGML work and does
__rendered_path__1
exactly what is wanted, with the added benefit that you can have multiple occurrences
__rendered_path__1
of &foo; if you need to include some text at more than one place. Unfortunately none of
__rendered_path__4
the browsers except Panorama support it, basically because very few of the
__rendered_path__1
programmers who write browsers bothered to read up on what can be done.
__rendered_path__1
* The second way is to use the facilities of your server. This has to be enabled by
__rendered_path__1
someone with access to the server configuration files (ask your WebMeister). For
__rendered_path__4
example, the NCSA server lets you embed a command inside an SGML comment:
__rendered_path__1
__rendered_path__1__rendered_path__4
<!--#exec cmd="cat myfile.html"-->

Page 14
Provided this occurs in a file with a special file type (eg .shtml, and this is what has to
__rendered_path__1
be specified in the server configuration), the server will parse the file and send out the
__rendered_path__3
result of the command embedded in the document.
__rendered_path__1
* There is in fact a vastly easier way to do this. SGML provides a PI mechanism
__rendered_path__1
(Processing Instruction) in the form:
__rendered_path__1
__rendered_path__3
<?cat myfile>
__rendered_path__1
SGML/ HTML couldn't care what you put inside (except it must not, for obvious
__rendered_path__1
reasons, contain the `>' character!). This would be a great way to specify a page break,
__rendered_path__3
for example: suppose you were processing an SGML file using PostScript, you could say
__rendered_path__1
<?showpage>...but again, none of the browsers except Panorama support this, again
__rendered_path__1
because they guys who write them have never bothered to actually read up on how
__rendered_path__1
SGML works.
__rendered_path__24
__rendered_path__27