| TAGS |
| HTML files are plain text files that have been “marked up” with special language elements called
tags, which are embedded in the text.
Tags are pieces of code enclosed in angle brackets.
Text surrounded by tags becomes an element; text between an opening heading tag and a closing heading tag would be considered a heading element.
There are two types of tags: Container tags and Empty tags
Container tags come in pairs; empty tags stand alone. Container tags use opening and closing tags.
For example: <TITLE> </TITLE> and <LI> |
Tags are not case-sensitive.
Good coding practice is to use all capital letters for tag names.
A tag can consist of the following three items inside the angle brackets, or
wickets:
- An element provides the main instructions of the tag. Elements include <TITLE>, <FONT>, <TABLE>, and many others.
- An attribute specifies a quality or describes a certain aspect of the element. For example, <DIV> has several attributes, including ALIGN.
<DIV ALIGN=”center” section> This text is a centered </DIV>
- A value gives value to the element and its attribute. For example, <DIV ALIGN=”center”> has a value that allows you to center text.
Some
HTML tags use only an element and do not support attributes and
values. Others, such as the <DIV> tag, support attributes and
values.
Quotation
marks are not always necessary when creating attribute values.
However, good coding practice dictates that you enclose all values
in quotes. Using quotation marks will never get you into the
trouble; omitting them may cause unexpected results. |
|
| Document |
|
Remember
that the primary function of HTML is to position content on the page.
Default
document names differ from server to server. Microsoft Internet
Information Server (IIS) looks for the default.htm document. Be aware that every HTTP server is preconfigured.
Apache web server looks for the index.html file.
More
ambitious pages may require file names extensions other than .htm
or .html. Active Server Pages files, for example, require the .asp
extension.
| At a minimum, an HTML 4.0 document must contain the following tags in the sequence
shown below. The Document Type Declaration (DTD) statement begins your HTML code by specifying the HTML version number and type used in the document.
It is technically an SGML statement.
<!DOCTYPE HTML PUBLIC
“-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML>
<HEAD>
<TITLE>Descriptive Page Title</TITLE>
</HEAD>
<BODY>
Page text and media
</BODY>
</HTML> |
| |
| You specify the flavor of
HTML by using a
Document Type Declaration (DTD)
tag:
Transitional
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0
Transitional//EN”>
Strict (means that the web browser will expect the use of style
sheets)
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Strict//EN”>
Frameset
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Frameset//EN”>
By using the DTD tag, you will improve your page’s ability to
work with browsers
|
| |
An empty tag, <META> describes the contents of your page.
This tag is quite useful with search engines because many spider programs look for it.
You can even use the <META> tag to make your page refresh automatically after a specified number of seconds:
<META HTTP-EQUIV=”Refresh” Content=”5; URL=http://www.cnn.com”> |
|
| |
| HTML Code by Type |
| Tag
Name |
Code |
| Document
Structure: |
| Body |
<BODY> |
| Head |
<HEAD> |
| HTML |
<HTML> |
There are two document sections: the
HEAD and the BODY.
Text between <TITLE> tags will appear in the title box of the browser window, in the history list, and on the page when printed. Title text also becomes the bookmark name if the page is bookmarked or added to a browser Favorites folder. |
| Titles
and Headings: |
| Heading - First/Six Level |
<H1>
or <H6> |
| Title |
<Title> |
| Paragraphs
and Lines: |
| Break |
<BR> |
| Horizontal Rule |
<HR> |
| Paragraph |
<P> |
| The HTML 4.0 hardwaremendation states that the <P> tag can be either a container or empty tag.
<BR> is always an empty tag.
|
Sequence of tags:
The tag that opens first closes last, and the tag that opens last closes first. |
HTML 4.0 hardwaremendation uses center as an ALIGN attribute
<P ALIGN=”center”> Your text here. </P>
WYSIWYG HTML editors use <CENTER>. |
| ALT designates alternate text to appear while the graphic is loading or for those using non-graphical
browsers: <IMG SRC=”image.gif” ALT=”alternate text”> |
| LINKS: |
| Anchor tag <A>
are container tags |
| Link to an anchor |
<A NAME="anchor
name"> |
| HREF
Hypertext reference |
| Link to another document |
<A HREF="filename"> |
| Linked graphic |
<A HREF="link
filename"><IMG SRC="graphic filename"> |
| Linked text |
<A HREF="link
filename">text to click</A> |
| Both internal and external links can become outdated, creating what some users call link rot. Another name for a web page that has out-of-date links is a cobweb. You should take the time to validate your links periodically. |