Hypertext Markup Language/Print Version: Before We Start
Hypertext Markup Language/Print Version: Before We Start
Hypertext Markup Language/Print Version: Before We Start
Introduction
HTML is a markup language used in most of the pages of the World Wide Web. HTML files are text files that,
unlike completely plain text, contain additional formatting markup—sequences of characters telling web browsers
what parts of text should be bold, where the headings are, or where tables, table rows and table cells start and end.
HTML may be displayed by a visual web browser, a browser that reads the text of the page to the user, a Braille
reader that converts pages to a braille format, email client, or a wireless device like a cellular phone.
Before we start
To author and test HTML pages, you will need an editor and a web browser. HTML can be edited in plain text
editors, including those that highlight HTML markup with colors to make it easier to read. There are also
WYSIWYG editors of HTML, and complex WYSIWYG(What You See Is What You Get) editors with website
project management and development environments
It is a good idea to learn XHTML, Javascript, ASP.NET and/or PHP to make high quality websites.
Plain text editors include Notepad for Microsoft® Windows, TextEdit for Mac, or Vim, Emacs and others for Linux.
Commercial HTML editors include Adobe Dreamweaver, GoLive, HomeSite, Contribute. There are also free HTML
editors out there including Microsoft's Visual Web Developer (for Windows), Evrsoft First Page (for Windows), Nvu
(for Windows, Mac OSX, and Linux) and Quanta Plus (only Linux versions available). It is usually better to gain a
basic knowledge of HTML using a code-based HTML editor before delving into the WYSIWYG editors (i.e.
Dreamweaver, GoLive, Contribute, Frontpage, Nvu, and Quanta+).
To preview your documents, you'll need a web browser. To make your documents look good to the greatest number
of readers, test the documents in several browsers. Each browser has slightly different rendering, and most have their
quirks, resulting in certain sequences of correctly written HTML rendered incorrectly.
Microsoft Internet Explorer is the most widely used browser, currently holding about 58% of the market. Other
common browsers include Google Chrome, Mozilla Firefox, Safari, and Opera. To make sure that your documents
are readable in a text only environment, you can use Lynx.
A simple document
Let's start with a simple document. Write this code in your editor, or copy-and-paste it, and save it as "index.html".
The file must be saved with the exact extension, and will not render or run correctly otherwise.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> Simple document </title>
</head>
<body>
<p>The text of the document goes here.</p>
</body>
</html>
HyperText Markup Language/Print version 2
Now open the document in your browser and see the result. From the above example, we can deduce certain
essentials of a HTML document:
• The first line of a valid HTML document must state which version of HTML the document uses. This example
uses the strict variant of HTML version 4.01.
• The HTML document begins with a <html> tag and ends with its counterpart, the </html> tag.
• Within the <html></html> tags, there are two main pairs of tags, <head></head> and <body></body>.
• Within the <head></head> tags, there are the <title></title> tags which enclose the textual title to be shown in the
title bar of the web browser.
• Within the <body></body> is a paragraph marked by a <p></p> tag pair.
• Most tags must be written in pairs between which the effects of the tag will be applied.
• <em>This text is emphasized</em> – This text is emphasized
• This text includes <code>computer code</code> – This text includes computer code
• <em>This text is emphasized and has <code>computer code</code></em> – This text is emphasized and has
computer code
• HTML tag pairs must be aligned to encapsulate other tag pairs, for example:
• <code><em>This text is both code and emphasized</em></code> – This text is both code and emphasized
• A mistake: – <em><code>This mark up is erroneous</em></code>
<head>
<title>This is the Title</title>
</head>
style
Used to embed style rules in a document. In web sites where consistent look across multiple web pages is
required, style should better be specified in a separate stylesheet file, linked using the link element.
link
Used to link the page to various external files, including a style sheet, or the location of the RSS feed for the
page. The type of link is set using the rel attribute. The type attribute specifies the MIME type of the document
found at the location given by the href attribute. This allows the browser to ignore links to MIME types it does
not support. Examples:
script
used to link to an external Javascript file or to embedded Javascript in the page. Linking to an external file is
the preferred technique in real web pages though many examples embedded the script for simplicity.
meta
used to set additional meta-data properties for the HTML document, such as related keywords, etc. Examples:
object
embeds a generic object. This element is not commonly used in the header section. It is normally used in the
body section.
There may also be a single base element. This element sets the base URI for resolving relative URIs. It is rarely
necessary to use this element.
The text, link, alink, vlink, bgcolor and background attributes have all been deprecated in HTML 4. This means that
they should not be used in new documents. They have been superseded by the CSS rules given below (using these
rules is discussed in a later section HTML Programming/CSS). The values from the previous example have been
used as examples in these rules.
text
body { color:black }
bgcolor
body { background-color:#DDDDDD }
background
HyperText Markup Language/Print version 4
Paragraphs
The p element is used to split text into paragraphs.
Headings
There are six levels of headings. The most important heading(s) in a document should be level one. Sub-headings
should be level two. Sub-sub-headings should be level three, etc. Do not skip levels. If the default sizes do not suit
your document, use CSS to change them. Headings should be used to effectively outline your content. By doing so,
users can find information more quickly (i.e. wikipedia), and some search engines use headings to help rank page
content.
This is Level 1
<h3>This is Level 3</h3>
This is Level 3
<h5>This is Level 5</h5>
This is Level 5
Example
This example will be used in the next section where we see how to change the appearance of a document.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Sundial</title>
</head>
HyperText Markup Language/Print version 5
<body>
<h1>Sundial</h1>
<p>A sundial measures time by the position of the sun. The most commonly seen designs, such as the
'ordinary' or standard garden sundial, cast a shadow on a flat surface marked with the hours of
the day. As the position of the sun changes, the time indicated by the shadow changes. However,
sundials can be designed for any surface where a fixed object casts a predictable shadow.
</p>
<p>Most sundial designs indicate apparent solar time. Minor design variations can measure standard
</p>
<h2>History</h2>
<p>Sundials in the form of obelisks (3500 BC) and shadow clocks (1500 BC) are known from ancient
Egypt, and were developed further by other cultures, including the Chinese, Greek, and Roman
cultures. A type of sundial without gnomon is described in the old Old Testament
(Isaiah 38:2).
</p>
<p>The mathematician and astronomer Theodosius of Bithynia (ca. 160 BC-ca. 100 BC) is said to have
invented a universal sundial that could be used anywhere on Earth. The French astronomer Oronce
Finé constructed a sundial of ivory in 1524. The Italian astronomer Giovanni Padovani published
a treatise on the sundial in 1570, in which he included instructions for the manufacture and
laying out of mural (vertical) and horizontal sundials. Giuseppe Biancani's Constructio
instrumenti ad horologia solaria discusses how to make a perfect sundial, with accompanying
illustrations.
</p>
<p>Many ornamental sundials are designed to be used at 45 degrees north. By tilting such a
sundial, it may be installed so that it will keep time. However, some mass-produced garden
sundials are inaccurate because of poor design and cannot be corrected. A sundial designed for
one latitude can be adjusted for use at another latitude by tilting its base so that its style
or gnomon is parallel to the Earth's axis of rotation, so that it points at the north celestial
pole in the northern hemisphere, or the south celestial pole in the southern hemisphere.
</p>
<p>A local standard time zone is nominally 15 degrees wide, but may be modified to follow
geographic and political boundaries. A sundial can be rotated around its style or gnomon (which
must remain pointed at the celestial pole) to adjust to the local time zone. In most cases, a
</p>
<p>To correct for daylight saving time, a face needs two sets of numerals or a correction table.
An informal standard is to have numerals in hot colors for summer, and in cool colors for
winter. Rotating the sundial will not work well because most sundials do not have equal hour
angles.
</p>
<p>Ordinary sundials do not correct apparent solar time to clock time. There is a 15 minute
variation through the year, known as the equation of time, because the Earth's orbit is
slightly elliptical and its axis is tilted relative to the plane of its orbit. A quality
sundial will include a permanently-mounted table or graph giving this correction for at least
HyperText Markup Language/Print version 6
each month of the year. Some more-complex sundials have curved hour-lines, curved gnomons or
</p>
</body>
</html>
Text Formatting
The Text Formatting elements give logical structure to phrases in your HTML document. This structure is
normally presented to the user by changing the appearance of the text.
We have seen in the Introduction to this book how we can emphasize text by using <em></em> tags. Graphical
browsers normally present emphasized text in italics. Screen readers, browsers which read the page to the user, speak
emphasized words with a different inflection.
A common mistake is to confuse the appearance of the element in your preferred browser for the meaning of the
element. This is one reason why you should use more than one browser to test your pages. Ideally you would use a
graphical browser, a text-only browser and a screen reader.
You can change the default presentation for any element using Cascading Style Sheets. For example if you wanted
all emphasized text to appear in red normal text you would use the following CSS rule:
em { font-style:normal; color:red; }
In this section, we will explore a few basic ways in which you can markup the logical structure of your document.
Emphasis
HTML has elements for two degrees of emphasis:
• The em element for emphasized text, usually rendered in italics.
• The strong element for strongly emphasized text, usually rendered in bold.
An example of emphasized text:
An example rendering:
It is essential not only to guess but actually observe the results.
An example of strongly emphasized text:
An example rendering:
Let us now focus on structural markup.
HyperText Markup Language/Print version 7
Preformatted text
Preformatted text is rendered using fixed-width font, and without condensing multiple spaces into one, which results
in preserved spacing. Newlines are rendered as newlines, unlike outside preformatted text. HTML markup in the
preformatted text is still interpreted by browsers though, meaning that "<em>a</em>" will still be rendered as "a".
To create preformatted text, start it with <pre> and end it with </pre>.
An example:
<pre>
,-----------------------,
| No. | Person |
|-----------------------|
| 1. | Bill Newton |
| 2. | Magaret Clapton |
'-----------------------'
</pre>
,-----------------------,
| No. | Person |
|-----------------------|
| 1. | Bill Newton |
| 2. | Magaret Clapton |
'-----------------------'
Omitting the preformatting tags will cause the same text to appear all in one line:
,-----------------------, | No. | Person | |-----------------------| | 1. | Bill Newton | | 2. | Magaret Clapton |
'-----------------------'
Special Characters
See also meta:Help:Special characters.
To insert non-standard characters or characters that hold special meaning in HTML, a HTML character reference is
required. For example, to input the ampersand, "&", "&" needs to be typed. Characters can also be inserted by
their Ascii or Unicode number code.
† † dagger
Abbreviations
Another useful element is abbr. This can be used to provide a definition for an abbreviation, e.g.
Graphical browsers normally show abbreviations with a dotted underline. The title appears as a tooltip. Screen
readers may read the title at the user's request.
Unfortunately, Internet Explorer version 6 and lower do not support abbr. It does however support the related
element acronym which has resulted in this element commonly being used for all abbreviations not just acronyms.
An acronym is a special abbreviation in which letters from several words are pronounced to form a new word (e.g.
radar - RAdio Detection And Ranging). The letters in HTML are pronounced separately, technically making it a
different sort of abbreviation known as an initialism.
Discouraged Formatting
HTML supports various formatting elements whose use is discouraged in favor of the use of cascading style sheets
(CSS). Let us have a short overview of the discouraged formatting, so that you know what it is when you see it in
some web page, and know how to replace it with CSS formatting. Some of the discouraged elements are merely
discouraged, others are deprecated in addition. HTML formatting is generally used with older browsers that do not
support CSS.
Continuing with the above example, lets say that the publisher has correctly marked up all their documents by
surround references to cited material (such as the name of a book) in the documents with the <cite> tag:
<cite>The Great Gatsby</cite>
Then to make all cited references bold, one would put something like the following in the style sheet:
Later someone tells you that references really need to be italic. Before CSS, you would have to hunt through all your
documents, changing the <b> and </b> to <i> and </i> (but being careful *not* to change words that are in bold that
are not cited references).
But with CSS, it's as simple as changing one line in the style sheet to
Hyperlinks
Hyperlinks are the basis of navigation of the internet. They are used for everything from moving around various
bookmarks in the same page, to downloading applications and jumping to web pages on other web servers. Let us
start with a quick example:
However, when there is a need to create links to multiple objects in the same directory tree as the web page, it is a
tiring procedure to repeatedly type out the entire URL of each object being linked to. It also requires more work
should the webpage move to a new location. This is where Relative URL's come in. They point to a path relative to
the current directory of the web page. For example:
home.html
./home.html
../home.html
This is a relative URL pointing to a HTML file called home.html which resides in the same directory (folder) as the
current web page containing the link. Likewise:
images/top_banner.jpg
This is another relative URL pointing to a subdirectory called images which contains an image file called
"top_banner.jpg".
HyperText Markup Language/Print version 13
Target Links
Now we are ready to create a hyperlink. Here is the basic syntax :
In the above syntax "URL location" is either the absolute or relative path of the object being linked to. "target" is an
optional attribute which specifies where the object being linked to is to be opened / displayed. For example :
The above example uses an Absolute URL of http://www.google.co.za, and specifies a target of "0" (which would
cause the URL to be opened in a new browser window). If frames are used, the name of a frame could be specified
as the target for the URL to open in. This is useful if you have one frame containing a navigation bar with important
links, and then another frame which is used to display the linked pages/objects.
Special targets
_blank
A new blank window is opened to load the linked document into. The location in the address bar (if shown in
the new window) gives the hyperlink location of the new resource requested by the user's clicking on the
hyperlink.
_self
The current frame that contains the document and the link to be clicked on is used to load the linked
document; if the link is part of a document that occupies a whole window then the new document is loaded
into the whole window, but in the case of a frame, the linked document is loaded into the current frame. The
location won't be shown in the address bar unless the linked document was loaded into the main window as
opposed to a child frame of a frameset.
_parent
The linked document is loaded into the parent frame of the one containing the link to be clicked on; this is only
important in nested framesets. If window W contains frameset F consisting of a child frame A and also a child
frame B that is itself a frameset FF with "grandchildren" frames C and D (giving us Window W with three
visible panes A, C and D), then clicking a hyperlink in the page in frame D with a target=_top will load the
linked document into D's parent frame, that is, into frame B, so replacing frameset FF that was previously
defined as the content of frame B. Documents C and D that were the frames of this frameset FF in B will be
entirely replaced and this will leave only frame A and the new document from the hyperlink left in frame B, all
inside the main frameset F in window W. The location is only shown in the address bar of the window if the
parent frame happened to be the window itself.
_top
HyperText Markup Language/Print version 14
The linked document is loaded into the window, replacing all files currently displayed in the window in
whatever frames they may be found in. The location at the top of the window, in the address/location bar is
seen to point to the linked document once the hyperlink is clicked.
Hyperlinks on images
An example:
<a href="http://en.wikipedia.org/wiki/HTML">
<img src="http://commons.wikimedia.org/wiki/Image:Html-source-code2.png"></a>
Example rendering:
<a href="http://en.wikipedia.org/wiki/HTML"> <img
src="http://commons.wikimedia.org/wiki/Image:Html-source-code2.png"></a>
As you can see, placing hyperlinks on images is in complete analogy to placing them on text. Instead of putting text
inside the a element, you place there an image.
Images
Let us start with a quick minimum example:
Images are mostly stored not directly in the HTML source, but rather in an external file. To place an image into an
HTML source, use the img tag with the src attribute containing the URL of the image file. To support browsers that
cannot render images, you can provide the alt attribute with a textual description of the image. To provide a tooltip to
the image, use the title attribute.
The space before the /> in the examples is there on purpose. Some older browsers behave strangely if the space is
omitted.
HyperText Markup Language/Print version 15
Placement
Per default, images are placed inline to its surroundings. To place the image as a block or float instead, you can use
Cascading Style Sheets.
The alt text should be the company's name not the ever popular 'Our logo', which would give the sentence 'Our logo
makes the best widgets in the world.' when read in a text only browser.
The alt attribute stands for alternate which non-graphic-capable browsers (such as Lynx) may use to better enable its
user to understand the purpose of the image. Many browsers, such as Internet Explorer, incorrectly use the alt
attribute' tag to produce image tooltips. However, the title attribute should actually be used for this. Other browsers
such as Mozilla Firefox display tooltips only when title is used.
All attributes
Above, we have covered some of the most important attributes of the img element. What follows is a list of all
attributes that are allowed in the img element as specified in the HTML 4 DTD:
src the URL of the image that should be displayed by the browser.
alt a short textual replacement for the image that may be used by the browser instead of showing the image, e.g. for blind users, users
without a graphic-capable browser or users who have disabled image loading.
name for backwards compatibility, use id in new documents - the name of the image which may be used by scripting languages.
id the unique identifier for the image which may be used by scripting languages.
class assigns one or more CSS classes to this image to control styling
title title of the image, which some browsers display in a hover box (tooltip), especially when the user holds his/her mouse steady over the
image for a short time.
align deprecated, use CSS in new documents - alignment of the image i.e. bottom, middle, top, left or right.
width the width of the image, for bitmap images this should be given as a plain number, e.g. 200, which would result in a width of 200 pixels
border deprecated, use CSS in new documents - border width when image is linking to something, usually set to 0
Lists
In HTML, there are three kinds of lists, each appropriate for a different kind of information. A bullet list, meant for
elements that have no order or the order is unimportant, is created using the <ul> and </ul> opening and closing tag.
A numbered list, meant for elements whose order matters, such as a sequence of steps to perform, is created using
the <ol> and </ol> opening and closing tag. Finally, there are definitions lists, created with <dl> and </dl> tags.
Ordered Lists
Ordered lists provide a lists of items, each of which are preceded by an incrementing number starting from 1.
Sample HTML:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Example rendering:
1. First item
2. Second item
3. Third item
Unordered Lists
Unordered lists display a list of items, each of which is prefixed by a bullet.
Sample HTML:
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
HyperText Markup Language/Print version 17
Example rendering:
• First item
• Second item
• Third item
Definition Lists
Definition lists display a list of bolded terms, followed by the definition on a new line and prefixed by a tab (by
default).
Sample HTML:
<dl>
<dt>Term 1</dt>
<dd>Definition of Term 1</dd>
<dt>Term 2</dt>
<dd>Definition of Term 2</dd>
</dl>
Example rendering:
Term 1
Definition of Term 1
Term 2
Definition of Term 2
If two terms share the same definition they can be grouped together like so:
<dl>
<dt>Cascading Style Sheets</dt>
<dt>CSS</dt>
<dd>Definition of Cascading Style Sheets (aka CSS)</dd>
<dt>Term 2</dt>
<dd>Definition of Term 2</dd>
</dl>
Example rendering:
Cascading Style Sheets
CSS
Definition of Cascading Style Sheets (aka CSS)
Term 2
Definition of Term 2
If a term has two alternative definitions use a separate dd element for each definition, e.g.
<dl>
<dt>Mouse</dt>
<dd>Small mammal</dd>
<dd>Input device for a computer</dd>
</dl>
Example rendering:
HyperText Markup Language/Print version 18
Mouse
Small mammal
Input device for a computer
Longer defintions can be broken up into paragraphs by nesting p elements within the dd element.
<dl>
<dt>Term 2</dt>
<dd>
<p>First paragraph of the definition.</p>
<p>Second paragraph of the definition.</p>
</dd>
</dl>
Example rendering:
Term 2
First paragraph of the definition.
Second paragraph of the definition.
Nested Lists
Lists can be nested. An example:
<ul>
<li>Lists
<ul>
<li>Numbered Lists</li>
<li>Unnumbered Lists</li>
</ul>
</li>
</ul>
Example rendering:
• Lists
• Numbered Lists
• Unnumbered Lists
When nesting, nested list elements should be within a parent list item element.
An example of incorrect nesting:
<ul>
<li>Lists</li>
<ul>
<li>Numbered Lists</li>
<li>Unnumbered Lists</li>
</ul>
</ul>
<ul>
<li>
Outer list item
<ul>
<ul>
<li>
Inner list item within two consecutive UL elements
</li>
</ul>
</ul>
</li>
</ul>
Note on format
The above descriptions of each of the three list types refer to the default rendering of the corresponding HTML code
by the web browser. However, by using CSS, you are able to change the formatting of the lists. For example, with
CSS you are able to make the lists horizontal as opposed to the vertical.
Example
An example of using lists to mark up a recipe for pancakes.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Pancakes</title>
</head>
<body>
<h1>A Recipe for Pancakes</h1>
<p>From <a href="http://en.wikibooks.org/wiki/Cookbook:Pancake">Wikibooks Cookbook</a>.</p>
<p>These pancakes make a good breakfast for a family.
They go well with real maple syrup.
They are healthy too (as long as you don't over do the syrup)
since whole wheat flour contributes to your fiber intake.
</p>
<h2>Ingredients</h2>
<ul>
<li>1 cup whole wheat flour</li>
<li>1 tablespoon common granulated sugar</li>
<li>2 teaspoons baking powder</li>
<li>1/4 teaspoon salt</li>
<li>1 egg</li>
<li>1 cup milk</li>
<li>2 tablespoons oil</li>
<li>additional oil for frying</li>
</ul>
<h2>Procedure</h2>
<ol>
HyperText Markup Language/Print version 20
Tables
Tables are used for presenting tabular data and abused for laying out pages. They can be inserted anywhere on the
page, even within other tables. We will be looking at creating a basic table and then adding lots of tags to it so we
can see just what the outcome will be. Experimentation is the name of the game here. The tags most useful when
creating tables are <table> - table, <tr> - table row, <td> - table data, and <th> - table heading.
Minimal tables
First let us have a look at quick example:
<table>
<tr><th>Food</th><th>Price</th></tr>
<tr><td>Bread</td><td>$2.99</td></tr>
<tr><td>Milk</td><td>$1.40</td></tr>
</table>
Every table begins with a <table> tag and ends with a </table> tag. In the table tag, you can define the attributes of
the table, as you will see later.
The table contains rows, each begins with the <tr> table row tag and optionally ends with the </tr> tag. Rows must
be inside tables.
The rows contain cells, each begins with the <td> table data tag and optionally ends with the </td> tag. Cells must be
inside rows.
If you put a table cell outside a row, or if you forget to close a cell, or row, or table it will have unpredictable results.
Text intended to be in the table may appear at an unexpected position, outside the table. At worst, the entire contents
of the table will not be displayed.
For example, in IE and Firefox:
HyperText Markup Language/Print version 21
• A cell outside a row is treated as in a separate row at the vertical position concerned
• All content outside cells, whether in a row or not, is put before the whole table, in the order in which it occurs; IE
puts each item on a new line; Firefox does not, but puts in some cases a blank space between items.
If the optional </td> and </tr> are not put, the above refers to content before the first row, and in rows before the first
element only. Note that </table> is required; if it is forgotten all following content is considered part of the last cell
of the last row, even further tables.
Task - Create a table
1. Open your default.htm and save it as table.htm in the appropriate folder
2. Create this HTML code in the body of the document
<table>
<tr><th>Food</th><th>Price</th></tr>
<tr><td>Bread</td><td>$2.99</td></tr>
<tr><td>Milk</td><td>$1.40</td></tr>
</table>
Food Price
bread $2.99
Milk $1.40
It doesn't look too much like a table yet, but we'll add more soon.
Note: This table is made up of two rows (check out the two <tr> tags) and within each row there are two data entries
(the two <td> tags)
You might compare a table with a spreadsheet. This one has two rows and two columns making 4 cells containing
data. ( 2 rows x 2 columns = 4 cells )
<table>
<caption>Formulas and Results</caption>
<tr><th>Formula</th><th>Result</th></tr>
<tr><td>1 + 1</td><td>2</td></tr>
<tr><td>3 * 5</td><td>15</td></tr>
</table>
Captions are useful for defining or describing the content of the table. They are optional.
To add a caption to a table, enter the caption element after the opening table tag, with the text of the caption
inside the element, as shown in the following.
<table>
<caption>Formulas and Results</caption>
...
</table>
HyperText Markup Language/Print version 22
Captions are usually displayed outside the border of the table, at the top. The exact appearance and placement of
captions is subject to CSS styling.
Table headings are a way of defining the contents of the table columns. They are usually only used in the first <tr>,
table row.
Instead of using a <td> for the cell, we use a <th>.
By default the text in table headings is displayed bold and centered.
The Syntax is: <tr><th>text</th><th>text</th></tr>
Task - Table Caption and Headings
1. Open your table.htm file
2. Add your own caption to the table
3. View the result
4. Add the table headings ITEMS and $ PRICE for the table
5. View the result
Borders
A border around a table is optional: sometimes they help to define the table, and sometimes the table looks better
without them.
However having borders turned on while you are creating the table is a very good idea since it makes tables much
easier to work with. You can get rid of the border once the table is completed.
or
bread $2.99 bread $2.99
<-- This row has three table datas, but one spans two rows because it uses rowspan="2"
<-- This row has only two table datas, because its first is being taken up.
Syntax:
• <td colspan=X> where X is the number of columns that the cell spans across.
• <td rowspan=X> where X is the number of rows that the cell spans across.
Task - Row span and column span
1. Open your table.htm file.
2. Experiment with making one table cell span across multiple rows.
HyperText Markup Language/Print version 25
3. Experiment with making one table cell span across multiple columns.
4. View the result each time.
<td bgcolor="colour">
<tr bgcolor="colour">
<table bgcolor="colour">
<td background="filename">
<tr background="filename">
<table background="filename">
Column groups
To specify a given format for a table column, you can use the <col> and <colgroup> tags. These tags are located at
the top of the table, and specify the default format for the given column.
With the <col> tag, the first instance indicates the formatting for the first column, the second for the second column,
and so on. <colgroup> works similarily, but also includes the span tag to cover multiple columns.
Summary
In this module you learn how to:
• Create and customise HTML tables,
• Control their dimensions and appearance,
• Add a caption to a table,
• Control the aligment of the table contents,
• Various attributes of the table tags.
HyperText Markup Language/Print version 26
Quotations
There are two kinds of quotations supported by HTML--inline ones and block quotations.
Inline quotations
An example:
Block quotations
An example:
Example rendering:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
Comments
HTML offers the possibility to insert comments into the page. To place a comment in your HTML code, start it with
<!-- and close it with -->. An example:
Unlike notes in office suites, comments are completely ignored by browsers, so the readers of the page have no idea
of their presence. They can be viewed in the source of the web page though.
You should avoid nested comments, as these can cause troubles to many browsers. An example:
<!--
Nested comments should better be avoided.
-->
-->
<p>The third paragraph.</p>
Forms
HTML forms are an easy way to gather data from the end user. Processing them requires a server-side scripting
language such as PHP or (in some cases when limited interaction is to be provided within a single page) a client-side
scripting language such as JavaScript.
Here is a simple form:
</fieldset>
</form>
Here's an explanation -
id
The name of the form or control.
action
The URL of a server-side script which can process the data.
method
The method used to send the information. Two methods are supported, POST and GET. POST is the preferred
method except for simple searches which generally use GET. Use with server-side languages.
fieldset
Form controls are normally contained in a fieldset element. Complex forms may have multiple fieldsets.
Fieldsets can contain other fieldsets.
legend
Each fieldset begins with a legend element. The content of the element is used as a title placed in the border of
the fieldset.
input type="" name ="" id=""
various types of input controls. Supported types are - submit, text, password, checkbox, radio, reset, file,
hidden, image and button. The name Attribute is used by the server to identify which piece of data was
entered in a given box on the form. The id attribute is used to match an input with its label. The name and
HyperText Markup Language/Print version 28
id attributes normally have identical values for text inputs but different values for checkbox and radio inputs.
label for=""
A label for a single form control. The value of the for attribute must match the id attribute of a form
control in the same form.
select
There is also a SELECT element for drop down lists and a TEXTAREA element for multi-line text input.
This simple example uses <br> tags to force newlines between the different controls. A real-world form would use
more structured markup to layout the controls neatly.
For a nice and comprehensive reference on forms, see the official W3 Technical Recommendation for forms [1].
CSS
So far we have seen how to divide text into paragraphs and to create section headings. Whilst HTML allows you to
define the structure of your documents it gives very limited control over their appearance. Cascading Style Sheets
(CSS) is a language that describes the presentation of documents. You can use CSS to alter the appearance of your
HTML documents.
This section gives an introduction to styling HTML with CSS. CSS itself is covered in the companion wikibook
Cascading Style Sheets.
Sundial
From Wikipedia, the free encyclopedia.
A sundial measures time by the position of the sun. The most commonly seen designs, such as the 'ordinary' or
standard garden sundial, cast a shadow on a flat surface marked with the hours of the day. As the position of the sun
changes, the time indicated by the shadow changes. However, sundials can be designed for any surface where a fixed
object casts a predictable shadow.
Most sundial designs indicate apparent solar time. Minor design variations can measure standard and daylight saving
time, as well.
History
Sundials in the form of obelisks (3500 BC) and shadow clocks (1500 BC) are known from ancient Egypt, and were
developed further by other cultures, including the Chinese, Greek, and Roman cultures. A type of sundial without
gnomon is described in the old Old Testament (Isaiah 38:2).
The mathematician and astronomer Theodosius of Bithynia (ca. 160 BC-ca. 100 BC) is said to have invented a
universal sundial that could be used anywhere on Earth. The French astronomer Oronce Finé constructed a sundial of
ivory in 1524. The Italian astronomer Giovanni Padovani published a treatise on the sundial in 1570, in which he
included instructions for the manufacture and laying out of mural (vertical) and horizontal sundials. Giuseppe
Biancani's Constructio instrumenti ad horologia solaria discusses how to make a perfect sundial, with accompanying
illustrations.
so that its style or gnomon is parallel to the Earth's axis of rotation, so that it points at the north celestial pole in the
northern hemisphere, or the south celestial pole in the southern hemisphere.
A local standard time zone is nominally 15 degrees wide, but may be modified to follow geographic and political
boundaries. A sundial can be rotated around its style or gnomon (which must remain pointed at the celestial pole) to
adjust to the local time zone. In most cases, a rotation in the range of 7.5 degrees east to 23 degrees west suffices.
To correct for daylight saving time, a face needs two sets of numerals or a correction table. An informal standard is
to have numerals in hot colors for summer, and in cool colors for winter. Rotating the sundial will not work well
because most sundials do not have equal hour angles.
Ordinary sundials do not correct apparent solar time to clock time. There is a 15 minute variation through the year,
known as the equation of time, because the Earth's orbit is slightly elliptical and its axis is tilted relative to the plane
of its orbit. A quality sundial will include a permanently-mounted table or graph giving this correction for at least
each month of the year. Some more-complex sundials have curved hour-lines, curved gnomons or other
arrangements to directly display the clock time.
By adding a style sheet the appearance could be changed to:
Sundial
From Wikipedia, the free encyclopedia.
A sundial measures time by the position of the sun. The most commonly seen designs, such as the 'ordinary' or
standard garden sundial, cast a shadow on a flat surface marked with the hours of the day. As the position of the sun
changes, the time indicated by the shadow changes. However, sundials can be designed for any surface where a fixed
object casts a predictable shadow.
Most sundial designs indicate apparent solar time. Minor design variations can measure standard and daylight saving
time, as well.
History
Sundials in the form of obelisks (3500 BC) and shadow clocks (1500 BC) are known from ancient Egypt, and were
developed further by other cultures, including the Chinese, Greek, and Roman cultures. A type of sundial without
gnomon is described in the old Old Testament (Isaiah 38:2).
The mathematician and astronomer Theodosius of Bithynia (ca. 160 BC-ca. 100 BC) is said to have invented a
universal sundial that could be used anywhere on Earth. The French astronomer Oronce Finé constructed a sundial of
ivory in 1524. The Italian astronomer Giovanni Padovani published a treatise on the sundial in 1570, in which he
included instructions for the manufacture and laying out of mural (vertical) and horizontal sundials. Giuseppe
Biancani's Constructio instrumenti ad horologia solaria discusses how to make a perfect sundial, with accompanying
illustrations.
Installation of standard sundials
Many ornamental sundials are designed to be used at 45 degrees north. By tilting such a sundial, it may be installed
so that it will keep time. However, some mass-produced garden sundials are inaccurate because of poor design and
cannot be corrected. A sundial designed for one latitude can be adjusted for use at another latitude by tilting its base
so that its style or gnomon is parallel to the Earth's axis of rotation, so that it points at the north celestial pole in the
northern hemisphere, or the south celestial pole in the southern hemisphere.
A local standard time zone is nominally 15 degrees wide, but may be modified to follow geographic and political
boundaries. A sundial can be rotated around its style or gnomon (which must remain pointed at the celestial pole) to
adjust to the local time zone. In most cases, a rotation in the range of 7.5 degrees east to 23 degrees west suffices.
To correct for daylight saving time, a face needs two sets of numerals or a correction table. An informal standard is
to have numerals in hot colors for summer, and in cool colors for winter. Rotating the sundial will not work well
because most sundials do not have equal hour angles.
HyperText Markup Language/Print version 30
Ordinary sundials do not correct apparent solar time to clock time. There is a 15 minute variation through the year,
known as the equation of time, because the Earth's orbit is slightly elliptical and its axis is tilted relative to the plane
of its orbit. A quality sundial will include a permanently-mounted table or graph giving this correction for at least
each month of the year. Some more-complex sundials have curved hour-lines, curved gnomons or other
arrangements to directly display the clock time.
body {
background:#ffc;
color:#000;
font-family:cursive
}
h1 {
color:red;
text-align:center;
font-size:1.2em;
font-weight:bold;
margin:0
}
h2 {
text-align:center;
font-size:1em;
font-weight:bold;
margin:1em 0 0
}
p {
text-indent:2em;
text-align:justify;
margin:0
}
<html lang="en">
HyperText Markup Language/Print version 31
<head>
<title>Sundial</title>
</head>
<body>
<h1>Sundial</h1>
<p>A sundial measures time by the position of the sun. The most commonly seen designs, such as the
'ordinary' or standard garden sundial, cast a shadow on a flat surface marked with the hours of
the day. As the position of the sun changes, the time indicated by the shadow changes. However,
sundials can be designed for any surface where a fixed object casts a predictable shadow.
</p>
<p>Most sundial designs indicate apparent solar time. Minor design variations can measure standard
</p>
<h2>History</h2>
<p>Sundials in the form of obelisks (3500 BC) and shadow clocks (1500 BC) are known from ancient
Egypt, and were developed further by other cultures, including the Chinese, Greek, and Roman
cultures. A type of sundial without gnomon is described in the old Old Testament
(Isaiah 38:2).
</p>
<p>The mathematician and astronomer Theodosius of Bithynia (ca. 160 BC-ca. 100 BC) is said to have
invented a universal sundial that could be used anywhere on Earth. The French astronomer Oronce
Finé constructed a sundial of ivory in 1524. The Italian astronomer Giovanni Padovani published
a treatise on the sundial in 1570, in which he included instructions for the manufacture and
laying out of mural (vertical) and horizontal sundials. Giuseppe Biancani's Constructio
instrumenti ad horologia solaria discusses how to make a perfect sundial, with accompanying
illustrations.
</p>
<p>Many ornamental sundials are designed to be used at 45 degrees north. By tilting such a
sundial, it may be installed so that it will keep time. However, some mass-produced garden
sundials are inaccurate because of poor design and cannot be corrected. A sundial designed for
one latitude can be adjusted for use at another latitude by tilting its base so that its style
or gnomon is parallel to the Earth's axis of rotation, so that it points at the north celestial
pole in the northern hemisphere, or the south celestial pole in the southern hemisphere.
</p>
<p>A local standard time zone is nominally 15 degrees wide, but may be modified to follow
geographic and political boundaries. A sundial can be rotated around its style or gnomon (which
must remain pointed at the celestial pole) to adjust to the local time zone. In most cases, a
</p>
<p>To correct for daylight saving time, a face needs two sets of numerals or a correction table.
An informal standard is to have numerals in hot colors for summer, and in cool colors for
winter. Rotating the sundial will not work well because most sundials do not have equal hour
angles.
</p>
HyperText Markup Language/Print version 32
<p>Ordinary sundials do not correct apparent solar time to clock time. There is a 15 minute
variation through the year, known as the equation of time, because the Earth's orbit is
slightly elliptical and its axis is tilted relative to the plane of its orbit. A quality
sundial will include a permanently-mounted table or graph giving this correction for at least
each month of the year. Some more-complex sundials have curved hour-lines, curved gnomons or
</p>
</body>
</html>
Open sundial2.htm with your web browser and you should see a page with a pale yellow background.
Validating HTML
There are fixed rules that define which tags may be used in an HTML document, where they can be placed. As your
documents get larger it can be difficult to be sure that everything is correct. There are automated tools that will check
your HTML for you. These tools are known as validators. Several validators are free to use, including
• Web Design Group HTML Validator [2]
• The W3C Markup Validation Service [3]
Try uploading the index.html or index.htm file you created in the previous section to one of the validators listed
above. Alternately both validators have options that let you enter HTML directly so you could cut and paste the
example from this page into the validator.
There is also an HTML-validating Firefox extension that can validate HTML using either HTML Tidy or the SGML
Parser (what the w3 validator is based on). It is available here [4] for all platforms.
It is good practice to validate each HTML document you create. Note that many visual design tools will let you
create invalid webpages so it is important to check pages produced in these packages as well.
If the HTML document is valid it means that the webpage will display exactly as you programmed it to on stable
W3C compliant browsers. In the case of text browsers such as Lynx, the text will format correctly so that it can be
read easily by the consumer. Knowing HTML also means that you can edit the pages created using WYSIWYG
programs manually, as these will without fail throw in unnecessary coding which clogs up and slows down the
loading of your page.
Conditional Comments
Conditional comments are a proprietary extension to Microsoft Internet Explorer for Windows (IE/win) version 5.0
and later. They are not available in Internet Explorer for Mac (IE/mac). They are a very useful way of handling the
CSS bugs in the various versions of Internet Explorer.
[[Category:]]== Syntax == An ordinary (X)HTML comment looks like this:
<!-- This text will be ignored by the browser. -->
Conditional comments add additional syntax to comments. The simplest example is:
<!--[if IE]> This text will be shown by IE/win ver. 5.0 and higher. <![endif]-->
Browsers that don't understand the conditional comment syntax will process this as a normal comment, i.e. the
content of the comment will be ignored.
Specific versions of IE/win can be targetted by changing the expression after the if. For example to target any
version of IE/win with a major version of 5 use:
<!--[if IE 5]> The major version number of this browser is 5. <![endif]-->
HyperText Markup Language/Print version 33
<html lang="en">
<head>
<title>Conditional comments</title>
</head>
<body>
<!--[if !IE]>-->
<p>This is page is not being viewed with Internet Explorer for Windows version 5.0 or higher.</p>
<!--<![endif]-->
<!--[if IE]>
<p>This is page is being viewed with Internet Explorer for Windows version 5.0 or higher.</p>
<![endif]-->
</body>
</html>
HyperText Markup Language/Print version 34
<head>
<title>Conditional comments</title>
<link rel="stylesheet" type="text/css" href="style.css">
<!--[if IE 5]>
<link rel="stylesheet" type="text/css" href="bugFixForIE5x.css">
<![endif]-->
</head>
External links
These tests for conditional comments [5] on Position is Everything may help you understand the quirks of conditional
comments.
Frames
Frames allow a section of the webpage to be constantly visible in a column or section, by having multiple pages
shown in separate subwindows. Usage of frames has been deprecated in HTML 4.0, and may only be used in
Transitional or Frameset mode. Frames have been replaced by a combination of Cascading Style Sheets and AJAX
scripting, as they keep a more suitable method of keeping or updating content on the screen.
Framing
Frames must begin with the <frameset> tag, and end with the </frameset> tag. The frameset has optional parameters
to determine the number of rows and columns along with their sizes (e.g. rows="2). A frameset tag may be nested
within another tag, to allow complex frame layouts.
Within a frameset element, you can either specify a new frameset, or add the <frame> element. The frame element as
the attributes src and name to specify the location of the document, and the name used for interconnection with other
links.
Since some web browsers cannot display frames you must specify alternate content for these browsers in a noframes
element within the frameset.
Inline frames
An inline frame begin with the <iframe> tag, and end with the </iframe> tag. As with the frame element, you can
apply the src and name attributes
Layers
Layers are not a part of HTML 4.01 or XHTML. They were a proprietary element created by Netscape. You can
achieve the same effect using CSS's z-index property.
Confusingly, Dreamweaver has a layers feature which is functionally similar but is based on div elements styled with
CSS and optionally animated with Javascript.
HyperText Markup Language/Print version 35
Music
Users should have control over the background sound or music; therefore, media player controls should always be
visible. Don't try to script your own controls since they might not work in all environments.
One valid way to do an autostarting (background) music player is to use Windows Media Player ActiveX for IE.
Other browsers like Firefox, Opera and Safari can use a generic solution which doesn't dictate what plugin should be
used. Plugin can be, for example, QuickTime (Windows, Mac) or MPlayer (GNU/Linux). If a suitable player doesn't
exist, then fall back to a plain link.
-Copy the following code to your site
-Replace all four occurrences of "clip.mp3" with correct filename
Other widely supported file formats are midi and wav, if you use those remember to change the type attribute
accordingly:
audio/midi for midi files
audio/x-wav for wav files
<!--[if IE]>
<object id="player" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="288" height="69">
<param name="URL" value="clip.mp3">
</object>
<![endif]-->
<!--[if!IE]> <-->
<object id="player" type="audio/mpeg" data="clip.mp3" width="288" height="69">
<param name="src" value="clip.mp3">
<a href="clip.mp3">Play background music artist - title [MP3]</a>
</object>
<!--> <![endif]-->
Conditional Comments
Conditional comments are a proprietary extension to Microsoft Internet Explorer for Windows (IE/win) version 5.0
and later. They are not available in Internet Explorer for Mac (IE/mac). They are a very useful way of handling the
CSS bugs in the various versions of Internet Explorer.
[[Category:]]== Syntax == An ordinary (X)HTML comment looks like this:
<!-- This text will be ignored by the browser. -->
Conditional comments add additional syntax to comments. The simplest example is:
<!--[if IE]> This text will be shown by IE/win ver. 5.0 and higher. <![endif]-->
Browsers that don't understand the conditional comment syntax will process this as a normal comment, i.e. the
content of the comment will be ignored.
Specific versions of IE/win can be targetted by changing the expression after the if. For example to target any
version of IE/win with a major version of 5 use:
<!--[if IE 5]> The major version number of this browser is 5. <![endif]-->
The text will display in IE/win versions 5.0 and 5.5.
To target a specific version number, e.g. 5.0, the syntax is slightly quirky.
• <!--[if IE 5.0]> You are using IE/win 5.0. <![endif]-->
• <!--[if IE 5.5000]> You are using IE/win 5.5. <![endif]-->
• <!--[if IE 6.0]> You are using IE/win 6.0. <![endif]-->
HyperText Markup Language/Print version 36
Inequalities can be used in the expression by placing an operator before the IE. The operators are:
lt
less than (but at least version 5.0 which is the lowest version supporting conditional comments)
lte
less than or equal (but at least version 5.0 which is the lowest version supporting conditional comments)
gt
greater than
gte
greater than or equals
Example:
<!--[if gte IE 6]> This text will be shown by IE/win ver. 6.0 and higher. <![endif]-->
All the expressions can be negated by prefixing with !, e.g.
<!--[if !gte IE 6]> This text will be shown by verions of IE/win ver. below 6 that support conditional comments.
<![endif]-->
<!--[if !IE]> This text will be not be shown by any version of IE/win that understands conditional comments. It won't
be shown by any other browsers either because they will treat this as a normal comment. <![endif]-->
The second example may seem pointless but with a small tweak you can arrange to hide text from IE/win version 5
and above.
<!--[if !IE]>--> This text will be not be shown by any version of IE/win that understands conditional comments. It
will be shown by other browsers because they will treat this as text sandwiched between two normal comments.
<!--<![endif]-->
The following HTML document is a working example.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Conditional comments</title>
</head>
<body>
<!--[if !IE]>-->
<p>This is page is not being viewed with Internet Explorer for Windows version 5.0 or higher.</p>
<!--<![endif]-->
<!--[if IE]>
<p>This is page is being viewed with Internet Explorer for Windows version 5.0 or higher.</p>
<![endif]-->
</body>
</html>
HyperText Markup Language/Print version 37
<head>
<title>Conditional comments</title>
<link rel="stylesheet" type="text/css" href="style.css">
<!--[if IE 5]>
<link rel="stylesheet" type="text/css" href="bugFixForIE5x.css">
<![endif]-->
</head>
External links
These tests for conditional comments [5] on Position is Everything may help you understand the quirks of conditional
comments.
Tag List
Following is a list of all elements in HTML 4, in alphabetical order. Click on a element for its description. XHTML
1.0 has the same elements but the attributes differ slightly.
The official list of elements is at Index of the HTML 4 Elements [6].
You can also view a list of standard attributes
• a
• abbr
• acronym – in most instances use abbr instead. See The Accessibility Hat Trick: Getting Abbreviations Right [7]
for some advice on using these elements.
• address
• (applet – deprecated, use object instead.)
• area
• b – use strong or the the CSS property font-weight set to the value bold instead.
• base
• (basefont – deprecated, set the CSS property font on the body element instead.)
• bdo
• bgsound Used for inserting background sounds.
• big – the CSS property font-size set to the value larger or a percentage greater than 100% may be more
appropriate.
• blink used to make the text blink (Depreciated).
• blockquote
• body Identifies the main content of a Web Page.
• br – use the p element for paragraphs. Use the CSS properties margin and padding to increase or decrease the
space between paragraphs. Consider using structured elements such as lists or tables instead.
• button
• caption
• (center – deprecated, use a div element instead and set the CSS property text-align to the value center.)
• cite
• code
HyperText Markup Language/Print version 38
• col
• colgroup
• dd
• del
• dfn
• (dir – deprecated, use ul.)
• div
• dl
• dt
• em
• fieldset
• (font – deprecated, use the CSS property font. For finer control use the CSS properties font-style, font-variant,
font-weight, font-size, line-height and font-family.)
• form Creates a form.
• frame Specifies information for one frame.
• frameset – avoid using frames if possible.
• head Contains information about a Web Page.
• hr
• html
• h1
• h2
• h3
• h4
• h5
• h6
• i – use em or the CSS property font-style set to the value italic instead.
• iframe
• img
• input
• ins
• (isindex – deprecated, use input.)
• kbd
• label
• legend
• li
• link
• map
• (menu – deprecated, use ul.)
• meta
• nobr is a proprietary element type supported by some web browsers. It is used to prevent automatic wrapping of
lines.
• noframes
• noscript Specifies what should be done if there is no javascript found on the browser.
• object
• ol
• optgroup
• option
HyperText Markup Language/Print version 39
• p
• param
• pre
• q
• (s – deprecated, use del to indicate deleted text. If the text isn't 'deleted' use the CSS property text-decoration set
to the value line-through.)
• samp
• script
• select
• small – the CSS property font-size set to the value smaller or a percentage less than 100% may be more
appropriate.
• span
• (strike – deprecated, use del to indicate deleted text. If the text isn't 'deleted' use the CSS property text-decoration
set to the value line-through.)
• strong
• style
• sub
• sup
• table
• tbody
• td
• textarea
• tfoot
• th
• thead
• title
• tr
• tt
• (u – deprecated, use the CSS property text-decoration set to the value underline instead.)
• ul
• var
Attributes
class
This attribute allows you to designate an element to be a member of a given class. Multiple elements can be assigned
to the same class (eg. <p class="myclass"> ... </p> <p class="myclass"> ... </p>), as well as a single element
belonging to multiple classes (eg. <p class="class-one class-two"> ... </p>).
HyperText Markup Language/Print version 40
dir
With this attribute you can define which direction the text is written for a given element, either ltr for left-to-right or
rtl for right-to-left.
id
This attribute allows you to define a unique identifier for each element. This would be useful for hyperlinks that link
to a specific section of a page or when styling using a style sheet.
lang
With this attribute you can specify a language that is used for an element.
style
This attribute allows you to apply specific styling to a given element.
title
With this attribute you can define what will be displayed when a user hovers the element. It is not available for base,
head, html, meta, param, script, style, and title.
More attributes
accesskey
The accesskey attribute defines a keyboard shortcut for a hyperlink or form element. The combination of keys need
to activate the shortcut varies from browser to browser. In Microsoft Internet Explorer the user must press
Alt+accesskey. If the shortcut is for a link the user must then press Enter to follow the link. The choice of
Alt+accesskey means that access keys can clash with shortcuts built-in to the browser.
It is quite common to use numbers for the access keys since these don't clash with any major browser's built-in
shortcuts, e. g.
• 1 = Home Page
• 0 = List of access keys on this website.
<div id="navigation">
<h2>Navigation</h2>
<ul>
<li><a accesskey="1" href="/">Home page</a></li>
<li><a accesskey="2" href="/about">About</a></li>
<li><a accesskey="0" href="/accesskeys">Access keys</a></li>
</ul>
</div>
There is no standard way to let users know the access keys that are available on the page. Some suggestions can be
found in Accesskeys: Unlocking Hidden Navigation [8].
HyperText Markup Language/Print version 41
Glossary
This is a glossary of the book.
: Top - 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
B
block element
TODO
E
element
A part of a document starting with an opening tag and ending with a closing tag, such as
"<p><b>keyword</b> is important</p>".
I
inline element
TODO
T
tag
The opening and closing sequence of characters of an element, such as "<p>" or "</p>". To be distinguished
from element.
Links
The web tutotials:
• PageFace - HTML & XHTML Tutorials [9]
• HTMLCenter [10] has over 200 HTML tutorials and a forum for questions.
• HTML Tutorials [11]
• HTML Source: HTML Tutorials [12] has step by step lessons.
• HTML Dog [13] tutorials.
• HTML and CSS Wiki [14] has another list of tutorials.
• HTML lessons and tutorials [15]
• Webmonkey.com's Tutorial [16]
• Free HTML Learning Resource [17]
HyperText Markup Language/Print version 42
References
[1] http:/ / www. w3. org/ TR/ html4/ interact/ forms. html
[2] http:/ / www. htmlhelp. com/ tools/ validator/ upload. html. en
[3] http:/ / validator. w3. org/
[4] http:/ / users. skynet. be/ mgueury/ mozilla/
[5] http:/ / www. positioniseverything. net/ articles/ sidepages/ cond_1. html
[6] http:/ / www. w3. org/ TR/ html4/ index/ elements. html
[7] http:/ / www. alistapart. com/ articles/ hattrick
[8] http:/ / www. alistapart. com/ articles/ accesskeys
[9] http:/ / www. pageface. com/
[10] http:/ / www. htmlcenter. com
[11] http:/ / www. pickatutorial. com/ tutorials/ html_1. htm
[12] http:/ / www. yourhtmlsource. com/
[13] http:/ / htmldog. com
[14] http:/ / c2. com/ cgi/ wiki?LearningHtmlAndCss
[15] http:/ / www. landofcode. com/ html/
[16] http:/ / www. webmonkey. com/ webmonkey/ teachingtool/ html. html
[17] http:/ / www. yoyobrain. com/ subjects/ show/ 23
Article Sources and Contributors 43
License
Creative Commons Attribution-Share Alike 3.0 Unported
http:/ / creativecommons. org/ licenses/ by-sa/ 3. 0/