Let us now look at tags in more detail. A <TAG> tells the browser to do something. An ATTRIBUTE goes inside the <TAG> and tells the browser how to do it. A tag can have several attributes. Tags can also have default attributes. The default value is a value that the browser assumes if you have not told it otherwise. A good example is the font size. The default font size is 3. If you say nothing the size attribute of the font tag will be taken to have the value 3.

Consider the example shown in Fig.1A. Type the code specified in the figure in a text editor such as notepad and save it as “fig1A.html”. To render the file and see your page you can choose one of two ways:

  1. Find the icon of the html file you  just made (fig1A.htm) and double click on it. Or,
  2. In Internet Explorer, click on File/Open File and point to the file (fig 1A.htm).

Figure 1A. A Simple Web Page


As shown in Figure 1A above, <HTML> is a starting tag. To delimit the text inside, add a closing tag by adding a “/” to the starting tag. Most but not all tags have a closing tag. It is necessary to write the code for an HTML page between <HTML> and </HTML>. Think of tags as talking to the browser or, better still, giving it instructions. What you have just told the browser is 'this is the start of an HTML document' (<HTML>) and 'this is the end of an HTML document' (</HTML>). Now you need to put some matter in between these two markers. Every HTML document is segregated into a HEAD and BODY. The information about the document is kept within <HEAD> tag. The BODY contains the page content.


The only thing you have to concern yourselves with in the HEAD tag (for now) is the TITLE tag. The bulk of the page will be within the BODY tag, as shown in Figure.1A.


Here the document has been given the title my web. It is a good practice to give a title to the document created. What you have made here is a skeleton HTML document. This is the minimum required information for a web document and all web documents should contain these basic components. Secondly, the document title is what appears at the very top of the browser window.


If you have a head, you need a body. All the content to be displayed on the web page has to be written within the body tag. So whether text, headlines, text-box, check-box or any other possible content, everything to be displayed must be kept within the BODY tag as shown in Figure 1A. Whenever you make a change to your document, just save it and hit the Reload/Refresh button on your browser. In some instances just hitting the Reload/Refresh button doesn’t quite work. In that case hit Reload/Refresh while holding down the SHIFT key.

The BODY tag has following attributes:
  • BGCOLOR: It can be used for changing the background color of the page. By default the background color is white.
  • BACKGROUND: It is used for specifying the image to be displayed in the background of the page.
  • LINK: It indicates the color of the hyperlinks, which have not been visited or clicked on.
  • ALINK: It indicates the color of the active hyperlink. An active link is the one on which the mouse button is pressed.
  • VLINK: It indicates the color of the hyperlinks after the mouse is clicked on it.
  • TEXT: It is used for specifying the color of the text displayed on the page.

Consider the following example:

Figure 1B. A Page with a Background Color

The values specified for BGCOLOR and TEXT tags indicate the color of the background of the page and that of the text respectively. These are specified in hexadecimal format. The range of allowable values in this format is from “#000000” to “#FFFFFF”. The“#” symbol has to precede the value of the color so as to indicate to the browser that has to be interpreted as a hexadecimal value. In this six digit value, the first two digits specify the concentration of the color red, the next two digits specify the concentration of the color green and the last two digits specify the concentration of the color blue. So the value is a combination of the primary colors red, green and blue and that is why it is called RGB color. If we specify the value “#FF0000”, the color appears to be red.”#000000” gives black and “#FFFFFF” gives the color white. You also have the option of specifying the color by giving its name, like: <BODY TEXT = “WHITE”>. You can also specify a background image instead. (Note that the image should be in the same folder as your HTML file. More on this below).

Try it out with the example HTML below:

Figure 1C. A Page with an Image in the Background