Here, we will introduce you to the basics of HTML. HTML stands for Hyper Text Markup Language. Using HTML we can create a Web Page which can be viewed through a Web Browser over Internet.
HTML describes the contents of a web page with Markup Tags. Tags are defined by angle brackets <>. <> is called the Opening Tag or the Start Tag. The Closing Tag or the End Tag is defined as </>. The whole HTML document is enclosed in between the opening <html> tag and the closing </html> tag. An HTML file has a .html or .htm extension.
When you will open a web browser and going to the View option of the Menu bar click to view the source code of the web page, you will see the general structure of the HTML document. At the start of the document, you will find the declaration of the HTML Version being used.
An HTML document is divided mainly into two parts- Head and Body. The Head element contains the Title of the Page which is written in between <title>...</title> tags. The Title of the Page will be shown in the Header of the Web Page.
The second part is the Body Element. This is the most important part of the HTML document. The Body element contains all the contents to be displayed in a web page (texts, images etc.).
Below here is the General Structure of an HTML document---
|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
...... Version of HTML
...... Opening of the HTML document
...... Opening tag of the Head
<title>My Home Page</title> ...... Title of the document
</head> ...... Closing Head tag
<body> ...... Start of the Body
............................ ........Contents of the body which may contain various kind .............. of elements like text, image, link etc ................................................................</body> ...... End of the Body element
</html> ...... End of the HTML document
The following Basic elements are used in a body that describe the contents of the body---
Each element has some properties or characteristics. These are referred to as attributes. An attribute has a specific value.
In HTML, six types of headings are used, viz, H1, H2, H3, H4, H5 and H6. Headings are important in maintaining the flow of the contents, i.e., the hierarchical structure of the document. H1 is the most important and H6 is the least important heading.
Each heading has an Opening tag and a Closing tag. The use of headings can be shown as below---
<h1>This is the first heading</h1>
<h2>This is the second heading</h2>
<h3>This is the third heading</h3>
<h4>This is the fourth heading</h4>
<h5>This is the fifth heading</h5>
<h6>This is the sixth heading</h6>
In the browser, it will become like this---
This is the first heading
This is the second heading
This is the third heading
This is the fourth heading
This is the fifth heading
This is the sixth heading
The format of the text in each heading is defined as default by HTML itself.
Paragraphs in an HTML page are encoded within <p> and </p> tags. However, the end tag is optional. The space between two paragraphs are automatically specified in HTML. We can insert a line break at any point of the document by using a <br> tag.
Look at the follwing example---
<p>This is my first paragraph.</p>
<p>This is another paragraph. This will give you<br>an introduction of HTML.</p>
The display in the web page will be as---
This is my first paragraph.
This is another paragraph. This will give you
There are three basic formatting elements used in HTML to make a text Bold, Italic and Underlined.
To make a text bold, <b> and </b> tags are used.
To make a text italic, <i> and </i> tags are used.
To make text underlined, <u> and </u> tags are used.
<b>This text is bold.</b>
<i>This text is italic.</i>
<u>This text is underlined</u>
The result will be---
This text is bold.
This text is italic.
This text is underlined.
To add emphasis to a word or a group of words, we use the <em> tag.
This is a <em>very interesting</em>lesson.
This is a very interesting lesson.
Images are often used in a web page. To add an image in HTML, we use the <img> tag. The path of the location of the image is written in the "src" attribute. If the image is located in the same folder as the web page then only the name of the image file is included. We can also format the size of an image by specifying its width & height.
Take the following example:
<img src="roop.gif" width="100" height="80">
This is an image with size of width 100px and height 80px.
The ALT attribute of an image:
The Alt attribute is used to give a short description of an image in case the image is not loaded in the web page due to some reason.
<img src="image.gif" width="100" height="80" alt="picture of a boy">
Here, in place of the image the text is displayed contained in the alt attribute of the image.
HTML provides the facility of links in a web page to other web pages. By clicking on some text as a link, we can go to a different web page. This is called Hyper Linking of web pages. This makes a web page dynamic.
The anchor tag <a> is used for this purpose. The location path of the web page to be linked is given in the "href" attribute. Href refers to Horizontal Reference. The text which is displyed as a link to the desired page is written in between the opening <a> and closing </a> tags.
<a href="address or URL of the web page">text as the link</a>
<a href="http://www.roseindia.net">Go to Roseindia</a> will create a link to the Roseindia Web Site.
On clicking the above link, the Roseindia Home Page will be open.
Three different types of lists are used in HTML. Unorderd list, Ordered list and Definition list.
(i) Unordered list is one in which the listing of the items is unordered. The <ul> tag defines an Unordered list and items are described by the <li> tag. The Bullets appear as the default style in an Unordered list. We can also specify the style format as "circle" or "square" in the type attribute.
List of some fruits:
|List of some fruits:
(ii) Similarly, an Ordered list is defined by <ol> tag.
List of some vehicles:
|List of some vehicles:
1,2,3,....is the default ordering style (type="1") in an Ordered list. The type of ordering can be changed by specifying the value of the type attribute as "i" for Roman, "A" for alphabets etc.
(iii) A Definition list is one in which definition or description of the items are given. A Definition list is defined by <dl> tag. The items are encoded in <dt> (defintion term) tag and the description of the items are encoded in <dd> (definition data) tag.
List of some beverages:
<dd>A type hot drink</dd>
<dd>Another hot drink</dd>
|List of some beverages:
All three <ul>, <ol>, <dl> has closing tags. But <li> is optional.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial