This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?

HTML Coding

Basics of Web Publishing: Essential HTML Elements

Note: The HTML pages are out-of-date and will not be updated.

The elements are special codes that identify the components of a Web page. The three elements that should be used in all Web pages are: HTML, HEAD, and BODY.

The example below illustrates the elements (with a title) for a Web document. The italics indicates text that will appear within the title bar or within the Web page. The bold indicates the element codes (tags).

The HTML element is used to identify the document as an HTML (Web) document. While some browsers do not require the HTML element, it is a good practice to get into. Failure to include this code will result in the document being unreadable by some browsers. The first code in the document is <HTML> and the last code in the document is the corresponding off code, </HTML>.

Note in the example below, the use of a <!DOCTYPE> declaration before the HTML code. While the use of the !DOCTYPE is optional, when used, it identifies as conforming to the HTML level 3.2 coding standards. This is useful for browsers and other software to determine which HTML version is being used.

Immediately following the ON code for HTML is the HEAD element. This element is used for meta-information. Meta-information is information about the document. The title is one example of meta-information. The title identifies the document and is displayed in the browser's title bar, used for bookmarks, and is used for indexing the file. The title does not appear within the Web page itself.

All other tags described in the Basics of Web Publishing collection of guides are within the BODY element. This element begins with <BODY> and ends with </BODY>. The BODY element contains the text, the links, and the image references that are contained in the Web page.

HTML Element Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"&GT

<HTML>

<HEAD>
<TITLE>Department Name, UW-Eau Claire</TITLE>
</HEAD>

<BODY>
Main text of the document to be written in between the BODY on and off codes.
</BODY>

</HTML>

 

return to topCoding Techniques

HTML codes (tags) are used to provide instructions to the Web browser. The codes are enclosed within less-than (<) and greater-than (>) signs. Using uppercase for your codes can make it easier to maintain your Web documents because the codes will stand out from the document text. Most codes have two components (paired codes). These codes contain an ON and OFF code. For example, to boldface an item the ON code will be <B> and the OFF code will be </B>. The slash indicates OFF and the B indicates the code that the boldfacing is being turned off.

Sample with no bolding:
Sample Text

Sample with code for bolding the word "sample:"
<B>Sample</B> text

Result of coding:
Sample text

Using white space (extra blank lines) in the Web editor is another technique that can make Web documents easier to maintain. The extra space helps separate the main sections for editing but does not impact the result when the document is read by the browser.

Using Comment Code

The HTML comment code can be used for internal documentation, such as notes for maintenance. Comments are displayed when the document is viewed in the Web editor and when the document source code is viewed through the browser--comments do not show up in the document as it is viewed normally on the browser. The ON code for a comment is an exclamation point (!) followed by two dashes (!--); the OFF code is two dashes (--). As with other HTML codes, the codes are contained within the less-than and greater-than symbols.

The following is an example of a comment within HTML; the codes indicating the start and end of the comment are in bold.

<!-- This is a comment about HTML -->

Excellence. Our Measure. Our Motto. Our Goal.