HTML Primer

HTML is the language you use to prepare documents for online publication. HTML documents are also called Web documents. A page is what you see in your browser at any time. Fach Web site whether on the Internet or on an intranet is composed of multiple pages, and you can switch among the pages by following hyperlinks. The collection of HTML out there makes up the World Wide Web.

A Web page is basically a text file that contains the text to be displayed and references to elements such as images sounds and of course hyperlinks to ether documents. You can create HTML pages with a text editor such as Notepad or with a WYSIWYG application such as Microsoft FrontPage. In either case the result-is a plain text file that computers can easily exchange. The browser displays this text file on the client computer.

Web pages are stored on computers that act as servers:-they provide a page to any computer that requests it. Each server computer has an address or URL that is some thing like the following:

The first portion http is the protocol used in accessing the server and is the name of the server on the Internet As I mentioned earlier all computers on the Internet have a unique numeric address such as 193.22.103.18. This numeric address is m own as the IP (Internet Protocol) address, which is more difficult for us humans to remember than names. The server looks up the mnemonic names in tables and translates them into IP addresses.

To post an HTML document on a computer so that viewers can access and display it with their browsers the computer that hosts the document must run a special application called the Web server. The Web server acknowledges requests by other computers the client computers and supplies the requested document The browser which is the application running on the client computer gets the document and displays it on the screen.

URLs and Hyperlinks

The key element in a Web page is the hyperlink a special instruction embedded the text that causes the browser to load another page. To connect to another comp and request a document the hyperlink contain the name of the computer hosts the document and the name of the document Just as each computer on Internet has a unique name each document on a computer has a unique name Thus each document on the World Wide Web has a unique address which is call . a URL (Uniform Resource Locator). The URL for a’Web document is something the following:

NOTE

You will notice that some URL Send in html and some end in html. They are identical. with the exception that the operating system on which the pages with the .extension html were developed doesn’t support long file names or the author chose to follow the DOS file-naming conventions. The sample pages you’ll find on the CD have the extension html which is a limitation imposed by the CD production process and has nothing to do with the system on which they were developed

Every piece of information on the World Wide Web has a unique address an can be accessed via its URL. “V chat the browser does depends on the nature of the item. If it’s a Web page or an image the browser displays It. If it’s a sound file. browser plays it back. Today’s browsers (such as Internet Explorer) can process many types of documents Others can’t. When a browser runs into a document’ can’t handle it asks whether the user wants to download and save the file on display or open it with an application that the user specifies

The Structure of HTML Documents

HTML files are text files that contain text and formatting commands. The commands are strings with a consistent syntax so that the browser can distinguish them from the text Every HTML tag appears in a pair of angle brackets (c»), The tag <I> turns on the italic attribute and the following text is displayed in the statement

HTML is <I>the<I> language of the Web.

will render the following sentence on the browser without the tags and with the word the in italics:

HTML is the language of the Web.

Most tags act upon a portion of the text and appear in pairs. One tag turns on a specific feature and the other turns it off. The <1>tag is an example and so are the <B> and <U> tags which turn on the bold and underline attributes. The tag that turns off an attribute is always preceded by a slash character. To display a segment of text in bold enclose it with the tags <B> and </B>.” Tags are not case-sensitive; for example, you could also enter the italic tags as <i> and «tt» In this book and on the companion CD-ROM, I use uppercase for HTML commands SO that they’ll stand out. Most WYSIWYG HTML editors Insert HTML tags in lowercase.

NOTE

The matching closing tag is not always required. For example you don’t need to use the pair <P><lP> to insert a paragraph; the single <P> tag will insert a line break.

The structure of an HTML document is shown next. If you store the following lines in a text file with the extension HTML and then open it with Internet Explorer you will see the traditional greeting. Here’s the HTML document:
<HTML>
<HEAD>
<TITLE>Your Title Goes Here</TITLE>
</HEAD>
<BODY>
Hello. World
</BODY>
</HTML>

To create the-most fundamental HTML document you must start with the <HTML> tag and end with the </HTML> tag. The document’s HEAD section marked with the <HEAD> and </HEAD> tags is where you normally place the following elements

• The-document’s title
• The META and BASE tags
• Scripts

The title is the text that appears in the title bar of the browser’s window and is specified with the <TITLE> and </TITLE> tags. META tags don’t display anywhere on the screen but contain useful information regarding the content of the document such as a description and keywords used by search engines. For example:

<HTML>
<HEAD>
<TITLE>Your Title Goes Here</TITLE>
<META NAME-‘Keywords’ CONTENT- _
‘health, nutrition weight control
</HEAD>
</HTML>

Attributes

Many HTML tags understand special keywords which are called attributes. The <BODY> tag which marks the beginning of the document’s body for instance recognizes the BG COLOR and BACK GROUND attributes which let you specify the color of the background or an image to appear in the document’s background. You can also specify the document’s background color (if there’s no background image) and the color of the text with the TEXT and BGCOLOR attributes

<HTML>
<HEAD>
.<TITLE>Your Title Goes Here</TITLE>
</HEAD>
<BODY BACK GROUNDs·paper.jpg’>
<H1>Tiled Background</H1>
<P>the background of this page was treated with a small imag  whi c·\ is
tiled vertically and horizontally by the browser.
‘<8R>
The image was designed so that its lett edge matches with its rlgh~
edge and its top edge matches with the bottom edge. Notice that yo~
can’t detect where one instance ends and the next one begins.
</BODY>
</HTML>

Background images start tiling at the upper-left comer and work their way across and then down the screen, Figure: 19.1 (the top image) shows an example. You can build nicely textured backgrounds by using the successive nature of the . tiles, and small image files can tile just .\S well as large ones. Be careful to merge the edges of the image files though, or you’ 11 end up with a “tiled” look unless perhaps that s what you’re aiming for (see the bottom image in Figure 19.1). Of course in this particular instance any color of text would hardly be readable unless it was large and had good contrast

A background image tiled
across the screen

Scroll to Top