Professional Documents
Culture Documents
For information about current course offerings, please visit: UTS Training
For current versions of course handouts, please visit: UTS Training Course Handouts
UNIVERSITY OF DENVER
BASIC HTML
COURSE OBJECTIVES:
Following the completion of this course, students will be able to write html code to do
the following:
• Create headings
• Apply comments
• Create tables
• Insert graphics
UNDERSTANDING HTML
HTML (HyperText Markup Language) is a programming language written in plain-text
format used to create interactive, online Web pages. The HTML is not displayed within
the browser, but rather provides the browser with instructions on how to display the
page content. It is important to have a basic understanding of HTML in order to
troubleshoot problems as they arise within your Web pages.
Web standards are not created by either Netscape or Microsoft. W3C or the World
Wide Web Consortium is the organizing body that dictates the standards which are
acceptable on the web. The most essential Web standards include: HTML, CSS and
XML.
HTML is made up of markup tags and attributes that work together to identify various
parts of the document and tell browsers how the document should be displayed.
Markup tags are enclosed in angle brackets (<>). Most tags are paired with an opening
(<>) and closing (</>) tag. The difference between the two is that the closing tag uses a
forward slash (/). HTML tags normally come in pairs such as:
<b>This will boldface the text.</b>
The text between the start and end tag is referred to as the element content.
HTML coding is not case sensitive. Entering the tag <B> is the same as <b>.
However, we suggest you get in the habit of using lowercase characters when writing
HTML tags. This is because the next generation of HTML (XHTML) will demand the
use of lowercase tags.
<!DOCTYPE…> TAG:
The <!DOCTYPE…> tag tells browsers what version of HTML is being complied with
and is the first line of HTML code that should be entered in a document. The document
type declaration tag names the Document Type Definition (DTD). HTML 4.01 lists three
different document type declarations: strict, transitional and frameset.
We recommend that you use the transitional declaration because it is the most flexible
version. The HTML 4.01 Transitional DTD should be typed as follows:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
"http://www.w3.org/TR/html14/loose.dtd">
In this example, the DTD element (Document Type Definition) tells browsers that the
document complies with the HTML version 4.01 Transitional standards. The Web
address included in the tag allows a browser to verify the correctness of the coding if it
chooses to do so. As new standards become available, the tag may change to indicate
a new version such as:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 5.23 Transitional//EN”
"http://www.w3.org/TR/html14/loose.dtd">
You do not need to revise the <!DOCTYPE> tag in existing documents as new
standards become available. The <!DOCTYPE> tag will not become invalidated.
STRUCTURE TAGS:
Structure tags provide browsers with information about the document. These tags
provide information such as the title of the page, what version of HTML is being used,
where the body of the document begins, etc. The content of these tags is not displayed
in the browser window.
The <html> tag identifies the start and end of the HTML document.
The <head> tag contains information about the Web page, such as the title of the page,
style sheets being used, and various other document descriptions. Text within the
<head> tag will not be displayed.
The <title> tag (within the <head> tag) is important because many search engines use
the title when retrieving relevant articles in a search. The text within the title tags will
also be displayed on the blue title bar of your browser as you view the page.
The <body> tag encloses all the information that will be displayed in the browser
window. Your entire Web page will be written between the beginning and ending
<body> tags.
META TAGS:
META tags, also located in the <head> section of your document, are used by many
search engines to compile their indices. You can improve a search engine's ability to
correctly index your page by including a brief description for your page in the
“Description” and “Keywords" META tag.
For example, if your page is about housing for DU freshman students, your META tags
might look like the following:
<meta name="description" content="Guide to Freshman housing on the
University of Denver campus">
<meta name="keywords" content="housing, Freshman, campus, University of
Denver">
The paragraph tag <p> is the most common tag that you will use. The start tag <p>
designates where you wish to begin a paragraph and the end tag </p> designates the
end of the paragraph.
The following example displays the HTML coding for a basic paragraph including the
center and left attribute which will either center or align that particular paragraph to the
left on the page. Note that the attributes are included within the start tag.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name=“description” content=”Basic HTML guide”>
<meta name=”keywords” content=”html, basic, guide”>
<title>Basic HTML </title>
</head>
<body>
<p align=center>This is a very basic HTML document. No formatting, graphics or
styles have been applied to the text. The text lines will break depending upon
the size of the browser.</p> <p align=left> This sentence will begin a new
paragraph even though I am typing the html coding on the same line as the
previous paragraph. It will be aligned to the left.</p>
</body>
</body>
</html>
Below is how the document would look if you were to preview the page in Internet
Explorer:
From this example, note that the text within the <title> tags is displayed on the title bar
of the browser window. The <p> tag marked the beginning of the paragraph and the
</p> tag marked the end of a paragraph regardless of the fact that you did not press the
Enter key on the keyboard to begin a new paragraph within your HTML coding.
NOTE: When using attributes it is important to understand that many of them are
deprecated. This means that they are outdated by newer capabilities. Deprecated
elements may soon become obsolete in future versions of HTML. Instead of applying
attributes, it is recommended that you create stylesheets to generate the formatting for
your text and link the stylesheet to your pages.
The break tag <br> is used when you want to begin a new line of text, but you don’t
want to create a new paragraph. No closing tag is needed for this tag.
Headings
Headings can be applied to break up large areas of text and announce various
categories within a document. HTML provides six different levels of headings. Heading
1 <h1> is the largest and Heading 6 <h6> is the smallest. By default, headings will
always be aligned to the left of your document. If you wish to center or right-align the
headings, apply the align attribute as described above. The align attribute would be
entered within the start heading tag.
Applying Comments:
A comment tag is used to insert a comment into the html code. Comment tags are
ignored by Web browsers so the text of a comment will never be displayed on the Web.
A comment might be inserted to provide explanation for the following code or it may
serve as a note to another user designating where they should input their data.
Comment tags always begin with an exclamation point followed by two hyphens. They
always end with two additional hyphens.
When lists are created within HTML, the list is either created as an ordered <ol> or
unordered <ul> list. The ordered list contains numbers or letters and the unordered list
contains bullets. Within the list, each item is identified by a list item <li> tag.
Ordered List:
<html>
<head>
<title>To-Do List</title>
</head>
<body>
</body>
</html>
Unordered List:
<html>
<head>
<title>To-Do List</title>
</head>
<body>
</body>
</html>
Formatting can be applied to individual letters and words as well. For example, you can
make a word appear bold, underlined, or italicized. Below is a list of common
formatting tags you may want to apply as well as an example of how they would be
used.
Below is how the code looks if you were to preview the page in Internet Explorer:
You can also apply several formatting tags to the same body of text. This is referred to
as "nesting". For example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Basic HTML</title>
</head>
<body>
<h1 align="center">Basic HTML </h1>
<p><i><u><b>This text is both italicized, underlined and in bold!
</b></u></i></p>
</body>
</html>
When nesting tags as illustrated above, always use the FILO rule (First In, Last Out.)
This means that the first tag listed initially, should be the last tag listed in the closing.
Web colors are often considered “unstable” and may display different hues from
computer to computer. This color instability is the result of differences in “gamma” and
the color space created by the operating system and monitor. Gamma is responsible
for the lightness and darkness of images. Various operating systems are based on
different standards of gamma, therefore; colors appear slightly different from one
computer to the next.
The only way to guarantee that the page will look the same on each user’s monitor is to
use “browser-safe” colors when designing your web page. Most monitors can display at
least 8 bit (256 colors), but only 216 colors are shared by various other browsers and
operating systems. These are considered the “browser-safe” colors. Many resources
are posted on the web listing “browser-safe” colors. One such site is
www.lynda.com/hexh.html.
When you have located a browser-safe hexadecimal value, enter the value as an
attribute of the body tag. For example, if you wish to change the background color
(bgcolor) of a page, enter the following:
<body bgcolor=FFFFCC>
To change the text color for the entire page, enter the following:
<body text=993300>
The font tag allows you to specify criteria regarding the font of the text. For example,
the font, font size and color are all attributes which can be applied within the font tag.
Begin by first placing the font tag around the text you wish to apply formatting to:
<font>This is the text I wish to format.</font>
Specify the font color attribute (using a hexadecimal value) you wish to apply:
<font face=Arial size=14 color=FF333> This text is typed in red Arial font
and is 14 points in size. </font>
Note: As mentioned previously, many of these attributes are deprecated and it is
recommended that you create a stylesheet containing all your formatting and then link
the stylesheet to your pages.
Tables are frequently used to organize the structure of a page. Several tags are
commonly used when creating a table:
Below are two commonly used attributes that can be applied to the table tag. A variety
of other attributes could also be applied.
Below is how the code looks if you were to preview the page in Internet Explorer.
A basic html link to another Web page might look like this:
The text between the start <a> and end tag </a> will be displayed as the hyperlink on
the Web.
Below is how the code looks if you were to preview the page in Internet Explorer:
E-mail links
An image tag referencing a graphic from the hard drive of your computer may look like
this:
<html>
<head>
<title>Fireworks</title>
</head>
<body>
<p>A photo of the fireworks:</p>
<p><img src="images/Fireworks.gif"> </p>
</body>
</html>
In this particular example, the Fireworks.gif image has been saved to the images folder
within the Web. The filename of the graphic is case sensitive. (You must then
remember to upload the images folder to the server in order for it be viewed correctly on
the Web.) Below is an example of how the code looks if you were to preview the page
in Internet Explorer:
An image tag referencing a graphic linked to a Website may look like this:
<img src="http://www.du.edu/clipart/library.gif">
ALWAYS create alternative text for graphics you place on the Web. This is important in
order to meet ADA standards. It is also important for those who use text-only
browsers. The descriptions within these “alt tags” will be displayed by hovering your
mouse over the graphic within a Web browser.
To create alternative text for a graphic, simply add an “alt” attribute within the image
tag. The attribute should provide a brief explanation of the graphic. For example:
<img src="../My Documents/Word/Graphics/Scratch/Fireworks.gif" alt=”4th
of July Fireworks”>
Images can also be used as a visual hyperlink. For example, the DU templates include
the DU logo in the top left corner. The logo is a hyperlink. If you click on the logo you
will be returned to the DU home page.
In the following example, if you click the graphic of Penrose Library, you will be taken to
the DU home page.
<a href="www.du.edu">
<img src="http://www.du.edu/clipart/library.gif" alt=Penrose library></a>
CREATING BOOKMARKS
Links within a page are referred to as "bookmarks." You can link to a bookmark from
any page in your Web, and you can establish bookmarks in any page within your
website. Bookmarks allow the user to jump directly into a specific section of the page
rather than forcing the user to scroll through the page looking for information.
You must first "bookmark" the text where you want the user to be directed to. The
name attribute is used within an anchor tag to create a bookmark. For example:
<a name="Help Desk">Help Desk positions</a>
To link to the bookmark or named anchor, add a # sign and the name of the bookmark
to the end of the href attribute. The text within the anchor tag again refers to the
hyperlinked text. For example:
<a href="#Help Desk">Positions within the Help Desk:</a>
CHARACTER ENTITIES
Many characters have a special meaning within HTML coding. For example, the less
than sign (<) designates an open tag and a slash (/) designates part of a closing tag.
When you need to use these characters within a document, you must instead insert
character entities into the source code.
Character entities contain three components: an ampersand (&), entity name, and a
semicolon (;).
The most common character entity is the non-breaking space. If you enter 15 spaces in
the HTML code, 14 of them will be removed. In order to add spaces within text, you
must apply the non-breaking space (nbsp) entity. It would look like:
DU TEMPLATE TAGS:
GLOM tags:
When working with DU templates, you may see GLOM tags throughout the HTML
document. For example:
<!-- GLOM /local/lib/httpd/htdocs/glom_files/navbar.glm -->
<!-- /GLOM /local/lib/httpd/htdocs/glom_files/navbar.glm -->
These tags are derived from Glommer which is a "home grown" DU program that lets
us quickly update a series of pages with standardized information. We recommend you
leave information between GLOM tags unchanged.
Link tags:
DU templates also include a “Link” tag located in the <head> section of your document.
It links your page to a DU specific stylesheet. This stylesheet gives a uniform look and
feel to many DU documents. For example, it indents the text on the page 15% from
either margin and includes styles for all your headings and text. We recommend you
leave the LINK tag as is. Below is an example of the LINK tag:
<LINK HREF="http://www.du.edu/dupages.css" REL="stylesheet" TYPE="text/css">
OTHER RESOURCES:
Here are some Websites you may find useful as you continue to learn HTML and build
Websites:
http://www.willcam.com/cmat/html/crossname.html
http://www.w3.org/TR/REC-html40/struct/global.html
http://www.w3.org
http://webreview.com
http://www.w3schools.com/default.asp
http://hotwired.lycos.com/webmonkey/reference/html_cheatsheet/
The following Websites provide free downloads for text editing software. You may find
software useful for writing HTML:
http://www.chami.com/html-kit/
www.editpadpro.com/editpadlite.html
The following Website provides another free trial version for text writing software:
http://www.textpad.com
University of Denver
University Technology Services - Training
Telephone: 303.871.3690 FAX: 303.871.4999 E-mail: kfriesen@du.edu
Copyright © 2003 University of Denver Page last revised September 11, 2003.