The Basic HTML Tags

No matter what you are going to do on the Web, some basic understanding of .HTML is required. HTML is certainly easy for a Visual Basic programmer to learn and use. The small part of HTML presented here is all you need to build functional Web pages. The following are the really necessary tags for creating no-frills HTML documents grouped by category

Headers

Headers separate sections of a document. Like documents prepared with a word processor HTML documents can have headers which are inserted with the <hn> tag. There are six levels of headers starting with <Hl> (the largest) and ending with <H6> (the smallest). To place a level header at the top of the document use  the tag <HI>:

<H1>Welcome to Our Fabulous Site</Hl>

A related tag is the <fiR> tag, which displays a horizontal rule and is frequently used-to separate sections of a document. The document in Pigure 19.2 which demonstrates the HTML tags discussed so far was produced with the following HTML file:

<HTML>
<HEAD>
<TITLE>
Document title
</TITlE>
</HEAD>
<BODY>
<Hl>Sample HTML Document</Hl>
<HR>
<H4>!he document Is body may contain:</H4> ”
<H4>Text images sounds and HTML commands</H4>
</BODY>
</HTML>.

A simple HTML document
with headeisa nda rule

FIGURE 19.2:
FIGURE 19.2:

Paragraph Formatting

HTML won’t break lines into paragraphs whenever you insert a carriage return in the text file. The formatting of the paragraphs is determined by the font(s) used in the document and the size of the browser’s window. To force a new paragraph you must explicitly tell the browser’ to insert a carriage return with the <P> tag. The <P> tag also causes the browser to insert additional vertical space.To format paragraphs without the additional vertical space use the <BR> tag

Character Formatting

HTML provides a number of tags for formatting words and characters Table 19.1 shows the basic character-formatting tags and following the table is a description of the FONT tag and its arguments.

TAB L E 1 9 • 1: The Basic HTML Character-Formatting Tags
TAB L E 1 9 • 1: The Basic HTML Character-Formatting Tags

The <FONT> Tag

Specifies the ‘name, size, and color of the font to be used. The <FONT> tag takes one or more of the following arguments:

• SIZE Specifies the size of the text in a relative manner. The value of the SIZE argument is not expressed in points, pixels, or any other absolute unit. Instead it’s a number in the range 1 (the smallest) through 7 (the largest). The following tag displays the text in the smallest possible size:

<FONT SIZE-l>tiny type</FONT>

The following tag displays text in .the largest possible size:
<FONT SIZE-7>HUGE TYPE</FONT>

• FACE Specifies the font that will be used to display the text. If the specified font does not exist on the client computer, the browser substitutes a similar font. The following tag displays the text between FONT and its matching tag in the Comic Sans MS typeface:

<FONT FACE – ‘Comic Sans’MS~> Some text </FONT>

You can also specify multiple typefaces. The browser uses the one specified first. If it’s not available, it tries the next one, and so on, as shown in the following:

<FONT FACE – ‘Comic Sans MS, Arial’> Some text </FONT>

If the Comic Sans MS typeface is mi- sing on the client computer the browser displays the text in Aria! (which should not be missing on any Windows machine). Some interesting typefaces designed.for Web pages (such as Verdana Comic Sans MS and Tahoma) ate installed along with Internet Explorer.

• COLOR Specifies the color of the text. You specify colors as hexadecimal numbers (#FFOOFF) or by name. Internet Explorer recognizes the following color names:

The following lines display the text in red:
<FONT COLOR-Red>This is red text</FONT>
<FONT COLOR-IFFOOOO> Thi5 is red text</FONT>
You can also combine multiple attributes in a single <FONT> tag as follows:
<FONT FACE-‘Aria’ Sans’ SIZE~5 COLOR-Red>

Hyperlinks

The tag that makes HTML documents come alive is the <A> tag which inserts hyperlinks in a document. A hyperlink is a string that appears in a different color from the rest of the text when the mouse pointer is over a·hyperlink the pointer turns into a finger (some browsers may display a different pointer but it will be clear that the text under the pointer is a hyperlink). When you click the mouse button over a hyperlink the browser requests and displays another document (which could be on the same or another server).

The <.A>and </A> tags enclose one or more words that will be highlighted as  hyperlinks. In addition, you must specify the URL of the hyperlink’s destination. For example, the DRL of the Sybex home page is:

The URL to jump to is indicated with the HREF attabute of the <A> tag. To display the string “VIsit the SYBEXhome page” and to use the word SYBEX as the hyperlink you enter the following in your document:

This inserts a hyperlink in the document and each time the user clicks on the SYBEXhyperlink, the browser displays the main page at the specified URL

NOTE

You need not specify a document name in the hyperlink. The server supplies the default page which is known as the home page. The home page is usually the entry to a specific site and contains hyperlinks to other pages making up the site.

To jump directly to a specific page on a Web Site, use a hyperlink such as the following:
View a document’on<A HREF – HTMl prOgramming</A> on the Sybex site.

Most hyperlinks on a typical page jump to other documents that reside on the same server. These hyperlinks usually contain a relative reference to another document on the same server. For example, to specify a hyperlink to the document Images.html that resides in the same folder as the current page use the £01- following tag:
Click <A HREF-“.\Images.htm’>here</A> to view the images.
, ‘,.(” .
If the Images.htm file resides in the Bitmaps folder under the current folder, you
use the following statement
Click <A HREF-“Bitmaps\Images.htm’)here</A> to view the images

Scroll to Top