An HTML page is a plain text file, composed of HTML tags. If you see an attractive HTML page with lot of graphics and animation, it is just another page with lot of tags used in an effective manner.
A tag is similar to a command. Every HTML tag is enclosed within < and >. For example, the tag used to display the text "Hello" in red color, with size 4 is as shown below:
<font color=RED size=4>Hello</font>
Every tag has a closing tag. For example, in the above html, the tag name is FONT. The closing tag is represented as </font>.
Similarly, there are several tags available to format text, display images etc. You will learn more about them later in this tutorials.
Structure of HTML Document
Every web page is a collection of HTML tags, organized in a specific format. There are some specific tags used to represet the structure of a web page.
A simple HTML document will look like this:
This is the page content
You may copy the above code to a note pad and save as 'test.htm'. Double click on the file and you can see it in the browser.
The Tag <HTML> says that this page is a html page. The first tag in an html page must be <HTML>. Also, the last tag must be </HTML>. The content of the web page is enclosed between these two tags.
The next required tag is <Head></Head>. This represents a header. There can be other tags within this tag. Anything inside this set of tags is an instruction to the browser and not displayed as part of the html page.
Even though it is not mandatory, one of the most widely used tag is <Title></Title>. You can enter any plain text between these tags and it will be displayed to the user as the title for the web browser.
You may look at the title of this web page. It is "Structure of HTML Document". Now view the source of this web page (Right click on this page and select "view source"). You will see the tag <Head> in the top portion of the tag with the above text enclosed between the tags.
<BODY> tag is another mandatory section of an HTML page. Anything placed between <BODY></BODY> are displayed in the web page. You can have plain text or other tags within the BODY tags.
<HEAD> tag and <&BODY> tags are placed within the <HTML> tags.