Basic HTML Tags
Course Outline

Getting Hyper

HTML Basics

Home pages can be simple or complex.

Most home pages are written in HTML - HyperText Markup Language.

HTML is based on tags. For example: <center> </center>

HTML files can be created using a text editor (Notepad), a word processor (Word), or with HTML software applications: HomeSite, Dreamweaver, FrontPage, etc.

The HTML source code of home pages can be viewed in Netscape by selecting View, Document Source, or in Internet Explorer by selecting View, Source.

There are HTML tags for all elements of a web page, including hypertext links, displaying images, showing backgrounds, playing audio, etc.

Some HTML tags are interpreted differently by different browsers.

Understanding HTML

Hypertext Markup Language (HTML) is the basic building block of the Web page

What is HTML?

Hypertext Markup Language -- HTML -- is a streaming text language that uses tags to format text, create hyperlinks to other places, and insert  images, sounds, and video.

HTML files live on a server. When a web browser requests the file, the server sends across one long unbroken string of ASCII text. The browser turns the long string into a viewable page. Any formatting, extra spaces, or unrecognizable characters that you put into your HTML file will be completely ignored by the browser. It turns anything it doesn't understand into a single space.

All HTML documents must have a filename extension of .html or .htm. For example, the name of this file is basic.html. The browser looks at the filename extension and knows to interpret the file as HTML tags rather than straight ASCII text.

A core set of HTML tags are standard, while others are only supported by certain browsers. The status of the "standard" and "non-standard" tags is always changing and it is important to remember that your HTML file may display differently on different browsers.

Tools You Need

To create an HTML file all you need is a simple text editor, such as Notepad.  You can also use word processors such as Word or Publisher and save the files as html.

HTML-specific editors also exist. These editors support the basic HTML tags and let you see the page as it will appear in a browser. Instead of typing tags, you can select commands from pull down menus, and click and drag items. Adobe, Netscape, Microsoft, Macromedia, and a score of other companies all offer HTML creation tools. This type of HTML software is known as WYSIWYG - which means What You See Is What You Get.
We are using Microsoft Front Page 2002 which is a combination of a WYSIWYG and text editor.

It's important to remember that even if you are using these graphical HTML tools, it is helpful to understand the HTML code itself. Understanding a little simple code makes it easier to fix problems on your page and simply understand why certain things are happening.

Back to top of page

HTML Tag Structure

In HTML terms, a document is made up of elements, which are portions of a document's structure such as titles, headings, lists, or paragraphs. Elements are defined by marking them up with tags.

There are two overall types of elements:

Block Elements. A Block element defines a paragraph constructed broadly (including Headings, Lists, and ordinary text paragraphs). Browsers insert a blank line before a block element.

Inline Elements. An Inline element defines a character styles, such as bold or italic, or some other element that fits within a line.

Whether you're talking about block or inline elements, they both consist of some or all of the following components:

  1. Start Tag. All elements begin with a start tag. The start tag is formed by typing a left angle bracket (<), the element name, and a right angle bracket (>). The tag may include one or more attributes, separated by a space.
  2. Element name. This is a code name, such as <title> or <h2>. 
  3. Attributes. With some elements you can specify additional information for the tag.  For example, the <img> element inserts an image on your page; The <img> element's  src attribute specifies where the image is located.
  4. Values. Most attributes require a value which is surrounded by quotation marks and preceded by an equals sign. For example, src="myimage.jpg" specifies the image source and gives the filename.
  5. Content. Every element that accepts content has a content model that specifies what can be included. The content model specifies the type of data that can go within the element. It also specifies which tags can go within the element. Foe example, the <head> element cannot contain text; it can only contain tags, such as <title>. The <title> element can only contain text.  Empty elements do not accept any content. An example is the <br> element, which causes a single line break.
  6. End tag. The end tag repeats the element name. It surrounds the name with angle brackets, like a start tag, but also has a slash mark that comes after the firat angle bracket (for example, </title>). This tells the browser when it has reached the end of the element.

A typical HTML tag might look something like this:

<H1 align="center">This is the element's content.</h1>

In this example, the start tag is the heading1 tag (<h1>).
The attribute is align and the value is center ( align="center"). The tag and attribute/value are separated with a single space.
The browser displays the content using the formatting it encounters with the tags you use. (This is the element's content.)
The end tag is </h1>.
 

Every HTML document has a global structure, which informs the browser that it has encountered an HTML page. Additionally, the global structure divides the document into two components:

Head. The information nested within the <head> element doesn't appear in the browser window, although <title> text does appear in the window's title bar.

Body. The text and markup within the b<body> element appear in the browser window.

Here's what the global structure looks like:

<html>
   <head>
     <title> Your document's title goes here</title>
   </head>
   <body>
Your document's content goes here.
   </body>
</html>

Back to top of page

Here are a few guidelines for using HTML tags:

When creating a tag, remember to separate each element -- the tag name and each of the attributes/values -- with a single space.

To use an attribute, type the attribute name, followed by an equal sign and the attribute value. Don't put a space between the attribute name, equal sign, or value.

If you don't use an attribute, the browser uses the default value for that tag. For example, the default value for paragraph alignment is left. If you use the paragraph tag without the align attribute/value, the paragraph will align left.

Some tags stand alone. For example, you insert a horizontal rule with a single  tag, like this: <hr>

Most tags create a state that stays in effect until you turn off the tag. For example, the bold command stays on until you turn it off. To turn off a tag precede the tag name with a forward slash. The following tags turn bold on and off. They are highlighted in color to make them stand out:
<b>Here's some text I want in bold</b>

posbul2a.gif (869 bytes) Tags are not case sensitive. <b> means the same as <B>.
posbul2a.gif (869 bytes) You may use the standard 26 alphabetical characters, and the number characters 0-9.
posbul2a.gif (869 bytes) You cannot use punctuation other than the "." which must come before the file type.
 

Back to top of page

 

HTML Tag Quick Reference Guide

This table summarizes the basic HTML tags. Click on a particular category of tags to jump directly to it, or browse the full reference list.

Document Basic Text Lists Links Images Imagemaps
Tables Frames Forms META Tags Style Sheets Special Characters
Structure Tags
Function Start Tag Attributes End Tag
HTML File <html> none </html>
File Header <head> none </head>
File Title <title> none </title>
Comments <!-- Your comments go between the start and end tags. Put a space between the -- and your comments. -->
Body <body> background="filename"
bgcolor="color value"
text="color value"
link="color value"
vlink="color value"
</body>
Division <div> align="right/left/center"
style="property:value;"
class="classname"
</div>
Span (inline) <span> style="property:value;"
class="classname"
</span>

Basic Text Tags
Function Start Tag Attributes End Tag
Line Break <br> clear="left/right/all" </br> or <br />
Paragraph <p> align="center/right" </p>
Bold <b> none </b>
Italic <i> none </i>
Typewriter Text <tt> none </tt>
Headline <h1-6> align="center/right" </h1-6>
Font <font> face="name, name"
size="+/-value/fixed size"
color="color value"
Note: the font tag is being phased out in favor of CSS styles.
</font>
Horizontal Rule <hr> size="XX"
width="XX/XX%"
noshade
</hr> or <hr />
Block Quote <blockquote> none </blockquote>
Division <div> align="left/center/right" </div>

List Tags
Function Start Tag Attributes End Tag
Unordered List <ul> type="disc/circle/square" </ul>
Ordered List <ol> type="I/A/1/a/i"
start="value to start counting at"
</ol>
List Item <li> type=all ul and ol options </li>
Definiton List <dl> none </dl>
Definition List Item <dt> none </dt>
Definition List Definition <dd> none </dd>

Link Tags
Function Start Tag Attributes End Tag
Anchor Link <a> href="filename"
target="windowname"
</a>
Anchor Mark <a> name="markname" </a>

Image Tags
Function Start Tag Attributes End Tag
Insert Image <img> src="filename"
align="left/right"
width="XXX"
height="XXX"
alt="text that desribes image"
ISMAP
USEMAP="#mapname"
</img>

Client-side Imagemap Tags
Function Start Tag Attributes End Tag
Define Map <map> name="mapname" </map>
Area Definition <area> shape="rect/circle/poly/point"
coords="X,Y,X,Y"
href="imagename"
</area>

Table Tags
Function Start Tag Attributes End Tag
Table <table> border="X"
width="XX/X%"
cellspacing="XX"
cellpadding="XX"
bgcolor="color value" background="filename"
</table>
Table Row <tr> align="left/center/right"
valign="top/middle/bottom"
bgcolor="color value"
</tr>
Table Data <td> align="left/center/right"
valign="top/middle/bottom"
width=X
nowrap
colspan="X"
rowspan="X"
bgcolor="color value"
</td>
Table Header <th> align="left/center/right"
valign="top/middle/bottom"
width=X
nowrap
colspan="X"
rowspan="X"
bgcolor="color value"
</th>
Caption <caption> align="left/center/right"
valign="top/middle/bottom"
</caption>

Frame Tags
Function Start Tag Attributes End Tag
Set Frames <frameset> cols="XX/XX%/*"
rows="XX/XX%/*"
</frameset>
Frame Definition <frame> src="filename"
name="framename"
noresize
scroll=auto/yes/no
marginwidth="XX"
marginheight="XX"
</frame>
Base <base> target="framename"/
"_self"/
"_top"/
"_parent"
(Note the underscores)
</base>
No Frames <noframes> Between start and end tags, place the content that appears when a non-frames browser loads this page. </noframes>

Form Tags
Function Start Tag Attributes End Tag
Form <form> method=get/put
action="programname"
</form>
Input Field <input> name="variablename"
type=text/password/
checkbox/radio/submit/
reset/image
</input>
Selection List <select> name="variablename"
size=XX
multiple
</select>
Selection Option <option> none </option>
Scrolling Text Field <textarea> name="variablename"
rows=XX
cols=XX
</textarea>

Meta Tags
Function Start Tag Attributes End Tag
<meta>
(Server metatags)
http-equiv="refresh"
content="seconds, filename"
none </meta>
<meta>
(Content metatags)
name="keywords/description/author/
generator/abstract/expiration"
content="your information"
none </meta>

Style Sheet Tags
Function Start Tag Attributes End Tag
Style Definition Area <style> type="text/css">
Style declarations go between begin and end style tags
</style>
Link to external CSS File <link> rel=stylesheet
type="text/css"
href="URL"
none

Commonly-Used Special Characters
Name Symbol HTML Equivalent
ampersand & &amp;
cent sign ¢     &cent;
copyright symbol © &copy; or &#169;
degree sign ° &deg;
greater than > &gt;
less than < &lt;
non-breaking space   &nbsp;
registered trademark ® &#174;
trademark &#153;

 
Back to top of page

Course Outline
Nancy Bryant