Basic concept of HTML documents

Basic structure of an HTML document

Sample HTML document to illustrate the structure of a web page

<HTML>
     <HEAD>
          <TITLE>This is the title of web page </TITLE>
     </HEAD>
     <BODY>
           Hello, Welcome to the world of web page!
     </BODY>
</HTML>

You can see some of the words in the upper case within a pair of angle brackets < and >. These are HTML tags. It is not necessary that tags be written in the upper case. HTML is not case sensitive. We can use either the upper or lower case or even a mix of the two. In this book, we follow the style of using the upper case for HTML tags and sentence case for attributes to distigush them from other words or text.

All HTML pages begin with the tag <HTML> and end with tag</HTML>. There are mainly two sections in an HTML document namely head section and body section. The <HEAD> tag  is used to define the head section. The head section contains the information about the document,including the title of the web page. The <TITLE>  tag is used to define the title of the page,which will be displayed on the title bar of the browser window. The <BODY> tag is used to define the body section contains the contents to be displayed in the web page.If we open this document in a web browser,it will appear as shown in figure.


Tags in HTML document

As mentioned ealier ,tags are the commands used in the HTML document that tell web browser how to format and organise our web pages to show the contents. Every tag consists of a tag name enclosed between the angle brackets '<' and '>'. HTML tags are not case sensitive. Therefore the tags <HTML>,<html>,<Html>,<HtmL>,etc. have the same meaning.

Container tags and empty tags

Most tags are used in pairs-an opening tag and a closing tag. For example <HTML> is the opening tag and </HTML> is the closing tag. Note that the closing tag has the same text as the opening tag,but has an additional forward slash(/) character after the first angle bracket. Tags that require opening tag as well as closing tag are known as container tags. Container tags are applicable fore a section. The opening tag is given at the begning of a Section and closing tag is placed at the end of the section. For example, <HTML> and </HTML> forms the opening and closing tag pairs for an HTML document.
Some tags are given an exemption to this rule, and these tags do not require closing tag. Such tags are known as empty tags. This kind of tag does not span over a section. The tags <BR>,<HR>,<IMG>,etc. are examples of empty tags. We will see these tags in the forthcoming section of this chapter.

Attributes of tags

Certain parameters are frequently included within the opening tag to provide additional information such as color,measurement,location,alignment or other appearances to the web browser. These parameters are called attributes. Most of the attributes require a value. In html ,the value can be given in single quotes or double quotes (I.e., attribute='value' or attributes="value"). Each tags has a standard set of a attributes and we can use them as per the requirement. If an attribute is used, their order of appearance is not important.


For example, to change the background colour of the web page to yellow, we can write the code as <BODY Bgcolor="yellow">. Here,Bgcolor is the attribute and Yellow is the value of this attribute. The other attributes of <BODY> tag and other tags will be discussed in the forthcoming section.

HTML Elements

A pair of tags and the content enclosed between these tags are know as an element. Body element contains the opening tag <BODY> with attribute if any,the closing tag </body>, and the contents in between these two tags.

The basic structure of an HTML document contains four sets of HTML tags.

They are:
           <HTML>           </HTML>
           <HEAD>            <HEAD>
           <TITLE>            </TITLE>
           <BODY>             </BODY>
           

Comments

Post a Comment

Popular posts from this blog

List in HTML

Inserting image