HTML Document Creation


HTML Document Creation

There are several tags used in HTML however in this section we will provide an introduction to HTML for Java programmers.

There are several tags used in HTML however in this section we will provide an introduction to HTML for Java programmers.

HTML Document Creation


We have already come to know about the Java Applets to be embedded within the HTML pages. There are several tags used in HTML however in this section we will provide an  introduction to HTML for Java programmers.

We have already learned the following tags.

* <HTML> HTML tag
* <HEAD> Header tag that can contain document information
* <TITLE> Header title tag that contains the document title
* <BODY> Body tag
* <H1>-<H6> Body heading tags
* <P> Body paragraph tag
* <BR> Body line breaks
* <APPLET> Java applet tag 

Additional Header Information

As we know how to use the HEAD and the TITLE tags, there are two more additional tags which are commonly used to insert the information into the HTML file.

The <META> Tag

The header tag can also contains the meta tag. Each document can contain an unlimited number of META tags. This data is a miscellaneous information that may be of use to someone that views the HTML source at a later date. 

 <META> has three attributes:

NAME-Used to define what information is stored in the current META tag. If NAME is used, HTTP-EQUIV should not be. 

CONTENT-The CONTENT attribute defines the actual contents of the META tag. 

HTTP-EQUIV- This enables the HTML author to tie the contents of a META tag to an HTTP server's response header. NAME should not be used if HTTP-EQUIV is used, NAME should not be. 

Lets tweak the example:
<TITLE>Sample Meta Information</TITLE>
<META NAME="Creation_Date" CONTENT="May 4, 2000">
<META NAME="Author" CONTENT="Jennifer">

The <BASE> Tag

To furnish a self-referencing URL for the document HTML  provides a <BASE>tag. This enables the remaining URLs to contain relative location information within the document instead of continually "hard-wiring" themselves. This is useful if a document is being used again and again at several locations.  The BASE tag has one attribute:

HREF-The HREF attribute is used to store the URL of the document containing the BASE tag. 

Overall Document Formatting

Several tags provided by HTML allow the document to provide a more visually appealing appearance by modifying the BODY Tag. It has several attributes. These attributes include the BGCOLOR, BACKGROUND, TEXT, LINK, VLINK, and ALINK attributes.

* BGCOLOR-Sets the background color of the document.
* BACKGROUND-Designates the URL of the background image to be used.
* TEXT-Sets the color of regular text (overrides browser defaults).
* LINK-Sets the color of hyperlinks (overrides browser defaults).
* VLINK-Sets the color of visited links (overrides browser defaults).
* ALINK-Sets the color of active links (overrides browser defaults). 

Complete Text Formatting

Text Formatting is the ability to change the size, type, and color of fonts, modify the highlighting of characters to show emphasis, and add onscreen effects such as horizontal lines and background coloring. 

Text Tags

The modification of various character styles to add effects to a document is done by the Text Tags. The following paragraphs shows the most popular of these styles, 
The <B>?</B> and <STRONG>?</STRONG> tags are used to boldface text. For these tags  simply place the text to be made bold within these tags.

Italicizing Text

The <I>?</I> and <EM>?</EM> tags are used to italicize text.
Setting the Base Font

The BASEFONT tag forces the size of all text within the page. It has one attribute, SIZE.

The syntax is


Using Anchors to Create Hyperlinks

The ability to create hyperlinks to other documents is accomplished by the Anchors. To embed these hyperlinks as part of the current document with the implementation hidden from the reader. HTML allows the creation of these hyperlinks through the use of the Anchor (<A>?</A>) tag.

The <A>?</A> tag by itself does nothing. To create hyperlinks, the <A>?</A> tag must be used in conjunction with one of its attributes such as HREF or NAME. 

Linking to Another URL

The HREF attribute is used to link to another URL from the current document. The <A> tag is called an anchor because it "anchors" text to a URL. Here is the syntax:

<A HREF="URL">LocationNameInText</A> 

The actual location name displayed to the user is not an actual attribute. Instead, it is "anchored" to the HREF attribute.

Linking within the Page

The NAME attribute is used to jump to a location at the end of the document to point to a remote URL. Using the NAME attribute actually requires two steps:
Using an anchor to set a link to the NAMED location.
Setting the NAMED location through the use of the # character.
The syntax is

<A HREF="#named_location">named_location_text</A>
<A NAME="named_location">link_name_text</A>

HTML and Images

We can improve the document's visual appeal by adding images to an HTML document. The HTML IMAGE tag is used to accomplish this task. The basic syntax for using the IMAGE tag is the following:

<IMG SRC="graphic_URL"> 

The following list gives more information on IMAGE tag attributes.

1. SRC-Used to set the URL of the image being loaded.
2. ALT-Contains text that will be displayed in text-only browsers (or browsers that have image-loading turned off).
3. ALIGN-Can be one of two possible values: TOP or MIDDLE. These values behave the same as the APPLET tag's ALIGN attribute.