Don's Notes About HTML
Copyright 2005 Don Woods
Examples:
This is an example of the <b>boldfaced text</b> tags.
You can use <B>uppercase</B> or <b> lowercase</b> instruction codes for your tags.Displayed by browser:
This is an example of the boldfaced text tags.
You can use uppercase or lowercase instruction codes for your tags.
<html> Everything that's part of the web page goes here. </html>Container tags mark a range of text for special treatment by the browser. The HTML document container tags, for example, identify the beginning and end of an HTML document. In the following examples, other types of container tags tell the browser how to format text inside the container. The ending tag of a container is distinguished from the beginning tag by a backslash symbol.
Examples:Containers can be nested inside other containers. They can also overlap each other.
<b>Boldfaced text</b> container
<i>Italicized text</i> container
<u>Underlined text</u> containerDisplayed by browser:
Boldfaced text container
Italicized text container
Underlined text container
Examples:
<i>This example combines italicized and <b> boldfaced</b> text.</i>
<i>This example combines italicized and <b> boldfaced</i> text.</b>Displayed by browser:
This example combines italicized and boldfaced text.
This example combines italicized and boldfaced text.
![]() |
Caution! Don't leave a space between the greater-than symbol and the instruction code. Don't forget the backslash symbol. |
<br> | Line break | Following text begins on next line. |
<hr> | Horizontal rule | Inserts a horizontal rule across page. |
<p> | Paragraph break | Inserts a blank line across page. |
Examples:
<input type=button value="Please Click Here">
<!-- Comment objects store notes for the page designer, but --> comments are not displayed.Displayed by browser:
comments are not displayed.
![]() |
Visit Don's Quick Reference to HTML Tags for a convenient, sorted list of the various Hypertext Markup Language tags. |
The Body section contains the text and objects displayed as a web page by a browser.
Example:The example above could have been written on a single line with the same results displayed by the browser. Browsers ignore line breaks, indentation and more than one consecutive blank space in the code of an HTML document. Extra space and blank lines are used by web page designers to make code easier for human beings to read.
<html> <head>
<title>Title displayed in browser title bar </title>
<!-- Created 6/13/05 by Don Woods, updated 6/16/05 -->
</head>
<body>
<h3>A headline would be appropriate here</h3>
Text to be displayed on page by browser.
</body> </html>
![]() |
For some hands-on practice at designing web pages, try Exercise 1 ("Getting Started") and Exercise 2 ("Basic HTML Structure") in Practical Exercises. |
Headlines are another tool we can use to dress up our web page. All browsers recognize six basic headlines sizes, ranging from <h1>, the largest, down to <h6>, the smallest. <h4> is indistinguishable from standard boldfaced text. <h5> and <h6> produce tiny boldfaced text.
A headline cannot be combined with standard paragraph text or another headline size on the same line, because the browser treats the end of the headline container as a paragraph break. You can underline or italicize all or part of a headline. Paragraph breaks and line breaks also work inside headlines. Boldface tags, however, do nothing to headlines, because headline text is already boldfaced.
Example:Indentation was used to emphasize the above example of a size 4 headline. This was done with the blockquote container.
<h4> This is a <i>size 4</i> headline <br>displayed on <u>two lines!</u>> </h4>
Displayed by browser:
This is a size 4 headline
displayed on two lines!
Example:The browser also inserts a paragraph break before and after a blockquote container. In the example above, a double indentation was created by nesting a second blockquote within the first.
<blockquote>
Everything between<br>
the blockquote tags will be indented.
</blockquote>Displayed by browser:
Everything between
the blockquote tags will be indented.
![]() |
You may occasionally see a web page with subscript and superscript
text. Bear in mind that subscript and superscript text distort line spacing and can make
a paragraph look messy. Fine print created by subscript or superscript text is also difficult to read. |
![]() |
For some hands-on practice with text and headlines, try Exercise 3 ("Headlines and Text") in Practical Exercises. |
Examples:
<ol>
<li>Red
<li>Green
<li>Blue
</ol><ul>
<li>Red
<li>Green
<li>Blue
</ul>Displayed by browser:
- Red
- Green
- Blue
- Red
- Green
- Blue
Example:
<dl>
<dt><b>Signal Colors</b>
<dd><b>Red</b>: Driver must stop, right turn permitted after stopping
<dd><b>Amber</b>: Caution, signal about to change
<dd><b>Green</b>: Driver may proceed through intersection
<p>
<dt><b>Compass Directions</b>
<dd>N = North
<dd>S = South
<dd>E = East
<dd>W = West
</dl>Displayed by browser:
- Signal Colors
- Red: Driver must stop, right turn permitted after stopping
- Amber: Caution, signal about to change
- Green: Driver may proceed through intersection
- Compass Directions
- N = North
- S = South
- E = East
- W = West
![]() |
For some hands-on practice with lists, try Exercise 4 ("Lists") in Practical Exercises. |
Examples:The size and color of ordinary text can be modified by setting the size and color properties of the font container. Fonts of size 4 through 6 are as big as headlines, but not boldfaced.
<p align=center>Example of centered text
<h4 align=center>Example of centered headline </h4>Displayed by browser:
Example of centered text
Example of centered headline
Examples:The background color of a web page is a property of its Body section container.
<font size=1>Size 1 is the <font color=green>smallest text</font> size.</font>
<font size=3>Size 3 is the default <font color=red>standard text</font> size.</font>
<font size=4>Size 4 is <font color=green> larger.</font></font>
<font size=8>Size 8 is the <font color=blue> biggest.</font></font>
Small and <font size=5>large</font> fonts can be combined on the same line.Displayed by browser:
Size 1 is the smallest text size.
Size 3 is the default standard text size.
Size 4 is larger.
Size 8 is the biggest.
Small and large fonts can be combined on the same line.
Example:
The beige color of this page was specified in its Body tag.
<body bgcolor=beige>
![]() |
For some hands-on practice working with properties, try Exercise 5 ("Properties") in Practical Exercises.
For a convenient, sorted list of the properties available with various containers,
objects and breaks, |
Examples:A link can also be used to redirect the browser to a named anchor on the same page or a named anchor on a distant site. This is done by assigning a name to the target anchor and attaching that name to the link's href property.
<a href="Exercises.html">Practical Exercises</a>
<a href="http://www.erols.com/jesterbear/stuff.html"> See some really neat stuff here!</a>Displayed by browser:
Practical Exercises
See some really neat stuff here!
Target anchor location:The first example above is a local link, used to reach the target from a source on the same page. The second will reach the target from another page within the same directory and the third from a more distant location.
<a name="Links">10. Anchors and Links</a>Links to target anchor:
<a href="#Links">Notes about Links</a>
<a href="Notes.html#Links">Notes about Links</a>
<a href="http://www.erols.com/jesterbear/DonsStuff/Notes.html#Links" >Notes about Links</a>Displayed by browser:
Notes about Links
Notes about Links
Notes about Links
![]() |
For some hands-on practice with anchors and links, try Exercise 11 ("Anchors and Links") in Practical Exercises. |
The alt property provides a label for the space where the image should appear. If the browser is unable to find the image file or for any reason unable to display the image, the label identifies the image that should have been displayed. The alt description of "box" will appear when you move your pointer onto the box image below.
Example:
<img src="box.jpg" alt="box" width=50>Displayed by browser:
![]()
![]() |
Caution! It's usually best to set only one dimension, allowing the other dimension to adjust proportionaly up or down to fit. Setting both dimensions could distort the image. In the example above, only the width property was adjusted. |
![]() |
For some hands-on practice with images, try Exercise 6 ("Images") in Practical Exercises. |
<table> | </table> | Table container |
<tr> | </tr> | Table row |
<th> | </th> | Table header, optional |
<td> | </td> | Table data |
Each cell of a table is created by either a table header container or a table data container. The optional table header stores only text, displayed boldfaced and center-aligned within the cell. A table data container may contain text or any type of object, including other tables nested between its tags. Its contents can be aligned within the cell using the align property. Background color can be set with its bgcolor property.
Example:The following example uses a table to create three columns on a page, with another table nested inside the third column. A border was omitted from the outer table, because the table's border property was not used to set a border. Cellpadding and cellspacing, measured in picas, assigns more space between the columns and rows.
<table align=left bgcolor=gold border=1>
<tr>
<th bgcolor=beige>Signal Color</th> <th bgcolor=beige>Signal Meaning</th>
</tr>
<tr>
<td align=center bgcolor=green>Green</td>
<td bgcolor=beige>Go</td>
</tr>
<td align=center bgcolor=yellow>Amber</td>
<td bgcolor=beige>Caution, light changing</td>
</tr>
<tr>
<td align=center bgcolor=red>Red</td>
<td bgcolor=beige>Stop</td>
</tr>
</table>Displayed by browser:
Signal Color Signal Meaning Green Go Amber Caution, light changing Red Stop
Example:
<table align=center cellpadding=3 cellspacing=3>
<tr>
<td><img src="signal.jpg"></td>
<td>Tables control how objects<br>
and text appear on a page,<br>
making highly complex<br>
displays possible.</td>
<td>
<table bgcolor=gold border=1>
<tr><th bgcolor=beige>Signal Color</th>
<th bgcolor=beige>Signal Meaning</th></tr>
<tr><td align=center bgcolor=green>Green</td>
<td bgcolor=beige>Go</td></tr>
<tr><td align=center bgcolor=yellow>Amber</td>
<td bgcolor=beige>Caution, light changing</td></tr>
<tr><td align=center bgcolor=red>Red</td>
<td bgcolor=beige>Stop</td></tr>
</table>
</td>
</tr>
</table>
Displayed by browser:
![]() |
Tables control how objects and text appear on a page, making highly complex displays possible. |
|
![]() |
For some hands-on practice with tables, try Exercise 7 ("Tables") in Practical Exercises. |
Example:The above example arranges the frames containing Sidebar and MyNotes as two columns on the framing page. The cols property sets the frame for Sidebar to a column filling 25 percent of the page. An asterisk allows the MyNotes column to fill the rest of the page. Alternatively, I could have used the asterisk for the Sidebar column and "75%" for the MyNotes column, or stated the percentages for both columns.
<html><head>
<title>Don's Notes</title></head>
<frameset frameborder=yes cols="25%,*" bordercolor=gold>
<frame src="Sidebar.html">
<frame src="MyNotes.html">
<noframes>
<body bgcolor=beige>
<h3 align=center>Don's Notes</h3>
Click on <a href="notes2.html"> Continue </a>
for a frame-free alternative.
</body>
</noframes></frameset></html>
To see the example displayed on your browser, Click Here!
![]() |
Caution! Frames are not universally accepted by browsers. In the example above, I provided alternative instructions inside a noframes container. Whenever you use frames, always include a noframes alternative. |
In the following example, the rows property was used to add a header and footer frame to the page. A second frameset, nested within a column of the first frameset, allows me to place the additional frames above and below MyNotes, leaving the entire left side of the page available to Sidebar.
Example:A frame is an identifiable object and can be assigned a name property.
<frameset frameborder=yes cols="25%,*" bordercolor=gold>
<frame src="Sidebar.html" name="frSidebar"><frameset frameborder=yes rows="15%,*,13%" bordercolor=gold></frameset>
<frame src="MyHeader.html">
<frame src="MyNotes.html">
<frame src="MyFooter.html">
</frameset>To see the example displayed on your browser, Click here!
Example:In the following example, a link in Sidebar uses its target property to change the src property in "frMain."
<frame src="MyNotes.html" name="frMain">
Example:Using "_top" as a target fills the entire browser window, eliminating the frame effect.
<html><head>
<title>Don's Sidebar</title>
</head>
<body bgcolor=gold>
<b><u>Index</u></b>
<ol>
<li><a href="MyNotes.html" target="frMain"> HTML Marker Tags</a>
<li><a href="MyNotes2.html" target="frMain"> Container Tags</a>
</ol>
</body></html> <p>
To return to the tutorial<br>
<a href="Notes.html#Frames" target="_top"> Click here!</a>To see the example displayed on your browser, Click here!
![]() |
For some hands-on practice with frames, try Exercise 12 ("Frames") in Practical Exercises. |
Most input devices are marked with the input object tag and identified by the type property. Other input devices have their own unique object tags.
Textboxes provide the client with a fill-in-the blank space to enter data.
Example:Buttons respond to the click of a mouse (or another pointing device). When the client's mouse clicks on the button, the button triggers a command to the browser, causing it to perform some sort of function. The value property of buttons identifies text to be displayed on the button.
Please enter your name: <input type=text size=20 name="txtName">Displayed by browser:
Please enter your name:
Examples:
<input type=button value="Generic Command Button">
<input type=reset value="Cancel selection">
<input type=submit value="Add selection to shopping cart">Displayed by browser:
Checkboxes and Radio buttons are turned on or off by the click of a mouse (or another pointing device) to indicate the client's selection. Radio buttons restrict a client to a single selection from a group (also known as an array) of radio buttons, while checkboxes may allow multiple selections.Example:In the above examples, names were assigned to textboxes, checkboxes and radio buttons. The value properties of these objects are used to store data received from the client. Names provide a means of identifying the objects where the data is stored, so that forms and scripts (discussed later) can find this information and use it. Reset, Submit and generic buttons are not used to store data.
Vehicle features:
<input type=checkbox name="ckSunRoof"> Sunroof
<input type=checkbox name="ckWideTires">Wide tires <input type=checkbox name="ckCDPlayer">CD player
<br>
Color:
<input type=radio name="rColor" value="red" checked> Red
<input type=radio name="rColor" value="silver"> Silver
<input type=radio name="rColor" value="white"> WhiteBrowser display:
Vehicle features: Sunroof Wide tires CD player Color: Red Silver WhiteThe checked property was used to make "red" the default value of the rColor radio buttons. A radio button or checkbox containing the checked property will automatically be checked when the browser opens the page.
Caution!
Be careful not to assign the checked property to more than one
radio button of an array (a group of objects with the same name).
For some hands-on practice with input devices,
try Exercise 8 ("Input Devices") in Practical Exercises.
15. Selection Lists
A selection list usually resembles a text box. It may have a default text or a blank space displayed inside. When the client clicks on an arrowhead button to the right of the space, a drop-down list of options appears. The value of each option is defined by the value property inside the option's tag. Text following the option tag is used to describe the option's value. This text appears in the drop-down list.Selection of an option assigns its value to the selection list value property. The drop-down list disappears and the option's description appears in the selection list's text box.
Example:The first option provides the default value and description of the selection list. A value of "" (null) or 0 (zero) is often assigned to the first option to indicate the client did not make a selection. Option values can be numbers or text.
<select name="selMonth">
<option value="">
<option value="Jan">January
<option value="Feb">February
<option value="Mar">March </select>Displayed by browser:
For some hands-on practice with selection lists,
try Exercise 9 ("Selection Lists") in Practical Exercises.
16. Text Area Containers
A text area box provides a comfortable input device for a client to record large amounts of text. It can also display a default value. Rather than using a value property inside the object tag, the default text appears between the text area's container tags. Everything between the tags is displayed in the text area box, including page breaks. The rows and cols properties define the size of the text area displayed, but do not limit the amount of text the client can record inside the box.Example:
<textarea name="areaDirections" rows=10 cols=40>
Directions to your house
from the Silver Spring Metro:
</textarea>Displayed by browser:
17. Forms
Individual input objects cannot independently transmit data across a network or interact with scripts. These capabilities are provided by a form, which may have several input objects stored between its container tags.Example:Enter a name and address in the text boxes above. Click on "Click Here." Then click on "Clear."
<form>
Name: <input type=text size=20 name="txtName"><br>
Address: <input type=text size=30 name="txtAddress"><br>
To do something...
<input type=button value="Click Here" onClick="DoSomething(this.form)"><br>
To clear form, click below.<br>
<input type=reset value="Clear">
</form>Displayed by browser:
In the example above, the "Click Here" button calls the "DoSomething" function. "DoSomething" is a script stored elsewhere on the same web page. Using "this.form" as the argument sent to "DoSomething" gives the function access to all of the form's objects.
"Clear" is actually a reset button. Its value property was used to give it a label that seemed more appropriate for this particular form. A reset button tells the browser to reset the values of the form's input objects to their default values, whatever the text boxes contained before the client entered any data. In the example, the text boxes were originally empty. If the page designer had used the value property of "txtName" to fill the text box with a default text, that text would appear in "txtName" when the page was opened and everytime the reset button was clicked.
Writing scripts goes beyond the scope of this tutorial, but the "DoSomething" function below is a simple example of scripts used to provide web pages with functionality. Script functions are stored inside a script container. Several functions may be stored inside the same script container.
Example:Tables are used to create neat, well-organized forms.
<script language=javascript>
function DoSomething(form){
strName = form.txtName.value;
strAddress = form.txtAddress.value;
strMessage = strName + " lives at " + strAddress;
alert(strMessage);
}
</script>Example:The Submit button signals the browser to transmit a form's data across a network to a distant web server, identified in the form container's action property.
<form>
<table>
<tr>
<td align=right>Name: </td>
<td><input type=text size=20 name="txtName"></td>
</tr>
<tr>
<td align=right>Address: </td> <td><input type=text size=30 name="txtAddress"></td>
</tr>
<tr>
<td align=right>To do something...</td>
<td><input type=button value="Click Here" onClick="DoSomething(this.form)"></td>
<tr>
<td align=right>To clear form, </td>
<td>click below.</td>
</tr>
<tr>
<td></td> <td align=right> <input type=reset value="Clear"><td>
</tr>
</table>
</form>Displayed by browser:
Example:
<form action="http://RegistrationDesk.org/cgi-bin/register.cgi" method=post>
<table>
<tr>
<td align=right>Name: </td>
<td><input type=text size=20 name="txtName" ></td></tr>
<tr><td align=right>Address: </td>
<td><input type=text size=30 name="txtAddress" ></td>
</tr>
<tr>
<td align=right>To register now, click on </td>
<td><input type=submit value="Submit Form"></td></tr>
<tr><td align=right>To clear form, </td><td> click below.</td></tr>
<td></td><td><input type=reset value="Clear"></td>
</tr>
</table>
</form>Displayed by browser:
Forms have two methods for transmitting data across networks: the get method and the post method.Get is commonly to send parameter data to search engines. It appends the form data to the end of the search engine's URL address, then sends the information across the internet just like a request for an ordinary web page file. This method is simple and quick, but it can be used only for short strings of data (less than 256 characters) and does not provide encryption.
Post is better suited for complex forms, especially forms used to collect confidential information. Instead of appending form data to the destination URL address, the Post method transmits data in a message-like format allowing encryption. The maximum size of a posted data stream depends upon the the destination server, but typical servers are designed to handle massive data flows.
For some hands-on practice with forms,
try Exercise 10 ("Forms") in Practical Exercises.
18. Meta Tags
Most web sites use meta tags to attract the attention of search engines, which look for keywords and descriptions.Example:The name property identifies the type of information stored by the content property of the meta tag. Meta tags should be placed only within the Head section of a web page.
<meta name=keywords content="HTML tutorial, HTML reference">
<meta name=description content="Don's quick references & tutorial for HTML">
19. Advanced Web Page Design
These notes cover only the basics of the Hypertext Markup Language, sufficient for building attractive informational web pages. If you'd like to work on interactive sites, with multiple pages and e-commerce tools, you should look for information on the following subjects:
- Javascript, a script language popularly used to provide functionality for web pages
(Don't confuse Javascript with Java; they're not the same language.)- Cascading Style Sheets (CSS), used to control the appearance of multiple pages on your site while reducing the amount of code needed to do so
- File Transfer Protocol (FTP), for uploading web page files from your computer to a distant web server
(You'll need an FTP client program to upload web pages from your computer to the web server.)- Common Gateway Interface (CGI), the category of programs used by web servers to process data received from browsers
- Perl, a language used to write Common Gateway Interface programs for web servers
- Apache Server, a popular web server program
- Unix, an operating system, the platform of most web servers
Visit Don's Quick Reference to HTML Tags for a convenient, sorted list of the various Hypertext Markup Language tags. For a convenient, sorted list of the properties available with various containers, objects and breaks, visit Don's Quick Reference to Properties of Containers, Objects, Breaks.
Thanks for visiting Don's Notes About HTML. Go to: Don's Main Menu